Why does my AI agent use a git branch that doesn't exist?

Because the agent guesses names. It assumes your default branch is main when it's master, remembers a branch from earlier that was deleted, or invents a name that sounds right. Git then fails, or worse, a command half-runs before the bad name is reached.

Why it happens

Models write git commands from patterns, not from your repository. Branch names are easy to get almost right. One public report shows a sub-agent returning a branch name that does not exist anywhere in the repo, the same made-up name twice in a row.

What you can do without Check

How Check stops it

Before a git command runs, Check asks your repository whether the branch, tag, commit, remote or subcommand it names exists. If it doesn't, the command is stopped and the agent gets git's own answer, so it can pick a name that's really there.

Try it.

100 free blocks, then A$0.10 for each action Check stops, from a prepaid balance. Allowed actions are always free. No subscription. Windows and Linux; macOS isn't supported yet. Get your key at the console, then run this in your own terminal:

npx @golproductions/check@latest --install

Or add Check as a plugin for Claude Code, Gemini CLI, Copilot CLI or Codex: the guide. Everything Check checks, and what it lets through: What Check does.

Your machine checks it before it runs.

100 free blocks. Get your GOL API Key at the console.