Summary: Most Aider problems fall into five buckets: the aider command isn't found, a broken install with dependency conflicts, missing or misnamed API keys, "Failed to apply edit" errors, and token-limit errors. Each has a short, documented fix, and almost all of them come down to installing Aider in its own environment, sending the model less context, or picking a model that follows Aider's edit format. This guide walks through each error in the order you are likely to hit it, checked against Aider's official documentation.
Aider is a free, open-source AI pair programmer that runs in your terminal and edits files inside a git repository using an LLM you connect with your own API key (or a local model). Because it sits between your shell, Python, git and a model provider, a failure can come from any of those four layers. The quickest way to debug is to figure out which layer is complaining before changing anything.
Step 0: Read the announcement lines first
Every time Aider starts, it prints a few "announcement" lines: the Aider version, the main model and its edit format, the weak model, whether a git repo was found, and the repo-map size. Aider's own troubleshooting page asks for exactly these lines when you report a bug, and they answer most questions on their own. For example, if the line says Git repo: none, then /undo and auto-commits can't protect you, and if the edit format is diff on a weak model, edit errors are more likely.
Inside a session you can also type /help <your question>. Aider has indexed its own documentation and answers with that documentation plus the context of your current chat, which is often faster than searching the web.
1. "aider: The term 'aider' is not recognized" (command not found)
This happens most often on Windows, when the folder that pip installs scripts into is not on your PATH or a security setting blocks it. The documented fail-safe is to run Aider as a Python module instead:
python -m aider
That works immediately, but the longer-term fix is to reinstall with one of the isolated installers (see the table below), which put a working aider command on your path.
2. ImportError or "requires somepackage==X.Y.Z" (dependency conflicts)
Aider pins specific versions of its dependencies and is tested only with those. If you pip-install it into the same Python environment as your own project, the two sets of requirements can clash, and you will see pip warnings like aider-chat ... requires somepackage==X.Y.Z, but you have ... or ImportErrors at startup.
Fix: give Aider its own environment
- Use
aider-install,uvorpipx. All three install Aider into a separate environment with the right dependency set. - Avoid system package managers such as Homebrew or AUR for Aider; the docs warn they often install it with the wrong dependencies.
- If you must use plain pip, use a virtual environment and be careful upgrading packages Aider pins. The docs specifically warn about upgrading
litellmon your own, because it changes often and sometimes breaks compatibility.
Install methods compared
| Method | Command (from the official install page) | Python it uses | Isolated from your project? | Best for |
|---|---|---|---|---|
| aider-install | python -m pip install aider-install then aider-install |
Your Python 3.8–3.13; installs a separate Python 3.12 if needed | Yes | Most people; the default recommendation |
| uv | uv tool install --force --python python3.12 --with pip aider-chat@latest |
Python 3.12, downloaded automatically if missing | Yes | People who already use uv or want a one-line reinstall |
| pipx | pipx install aider-chat |
Python 3.9–3.12 per the docs | Yes | People who already manage CLI tools with pipx |
| Plain pip | python -m pip install -U --upgrade-strategy only-if-needed aider-chat |
Python 3.9–3.12 per the docs | Only inside a virtual environment | Advanced users; most likely to cause the errors above |
One thing worth knowing: the install page lists Python 3.9–3.12 for pip and pipx, but the metadata of the current release on PyPI (aider-chat 0.86.2) requires Python 3.10 up to, but not including, 3.13. If pip says no matching version is found, check python --version first; on Python 3.13 or newer, let aider-install or uv fetch Python 3.12 for you.
3. Model and API key problems
If you don't name a model, Aider looks at which API keys it can find (environment variables, config files, command-line arguments) and picks a model to match. If it finds no keys at all, it offers to connect you to OpenRouter, which has both free and paid models. Surprises usually come from that automatic choice, so be explicit:
aider --model sonnet --api-key anthropic=YOUR_KEY aider --model deepseek --api-key deepseek=YOUR_KEY
Where keys can live
- Command line:
--openai-api-keyand--anthropic-api-keyfor those two providers;--api-key provider=KEYfor everyone else, which simply setsPROVIDER_API_KEY(so--api-key gemini=xxxsetsGEMINI_API_KEY). - Environment or a .env file: lines like
OPENROUTER_API_KEY=.... Aider loads .env files from your home directory, the git repo root, the current directory and any file passed with--env-file, and later ones win. - .aider.conf.yml: an
api-key:list with entries like- gemini=foo.
Model warnings and what they mean
- "Unknown context window size and costs, using sane defaults": Aider doesn't recognise the model name. It assumes an unlimited window and zero cost. You can usually ignore this, but check for a typo, because Aider will often add "Did you mean one of these?" with the correct name.
- "Missing these environment variables": set every variable listed (for Azure, that is the API base, version and key). On Windows, variables set with
setxonly appear in a new terminal, so restart it. - "Unknown which environment variables are required": Aider can't check for you; look up the provider in Aider's LLM docs or the LiteLLM docs.
4. "Failed to apply edit to filename"
This is the most common complaint, and it is usually not a bug in Aider. The model replied with changes in a format Aider didn't expect, so nothing was written to disk. The documented fixes, roughly in the order I would try them:
- Shrink the context. The docs note that above about 25k tokens of context, most models get distracted and stop following the system prompt. Add only the files that need editing, because Aider already sends a map of the rest of the repo. Use
/dropto remove files,/clearto wipe the chat history, and/tokensto see what each message costs. - Use a stronger model. Weaker and heavily quantised local models are much more likely to break the edit format; the docs describe most local models as "just barely capable" of working with Aider.
- Switch to the whole-file format. Start with
--edit-format whole. The model rewrites entire files instead of diffs, which costs more output tokens but is easier for weak models to get right. - Try architect mode. Start with
--architector type/chat-mode architect. One model proposes the change and a separate editor model turns it into file edits, which the docs say is often more reliable for models that struggle with edit formats.
A related habit that prevents bad edits: use /ask to agree on a plan first, then switch to /code and say something short like "go ahead". Ask mode never touches files.
5. "Model has hit a token limit!"
Aider never enforces token limits itself; it only passes on the error from the provider, and its token counts are estimates. The error tells you whether input or output was exceeded, and the fix is different for each.
Input or context window exceeded
You sent too much. Drop files you don't need, clear the history, or split large source files so less code has to be in the chat.
Output limit exceeded
Many models can only return a few thousand tokens at once, so a sweeping change gets cut off. Ask for smaller changes per request, break big files apart, and use a model that can return diffs instead of whole files. Note that this pulls in the opposite direction from fix 3 in the edit section: the whole format helps weak models but uses more output, so it can trigger this error on big files.
Proxies and local servers
The docs also point out that non-compliant API proxies and bugs in local model servers can produce false token-limit errors. If you use a proxy, try connecting directly to the provider once to rule it out.
6. Local models with Ollama behave strangely
If you run Aider against Ollama, use the ollama_chat/<model> prefix (the docs recommend it over ollama/) and set OLLAMA_API_BASE, usually http://127.0.0.1:11434. The bigger trap is Ollama's default context window, which the Aider docs give as 2k tokens. Ollama silently drops anything beyond it, so the model may seem to "forget" your files. Aider now sizes the window for each request automatically, but you can pin a larger fixed one with num_ctx in a .aider.model.settings.yml file, or start the server with OLLAMA_CONTEXT_LENGTH=8192 ollama serve as the docs show. If Ollama itself won't start or can't see your GPU, our Ollama troubleshooting guide covers that side.
7. Undoing a bad change
When Aider runs in a git repo, it commits every edit with a descriptive message and first commits any uncommitted work of yours separately, so your changes and its changes never mix. That means /undo discards the last AI change and /diff shows what changed since your last message. If you launched it with --no-git or --no-auto-commits, you lose that safety net, so keep your own backups. Also note that by default Aider skips pre-commit hooks; add --git-commit-verify if your repo depends on them.
Editor's note
Who Aider suits: developers who are comfortable in a terminal and git, and who want to choose and pay for their own model. Who it doesn't suit: people who want a graphical editor panel or a fixed monthly plan; an IDE extension is a better fit there (see our Cline tutorial).
Gotchas I found while checking the docs: the Python versions on the install page (3.9–3.12) and on PyPI for the current release (3.10–3.12) don't match exactly; the docs' "capable model" list still names older models such as GPT-4o and Claude 3.7 Sonnet, so treat it as a minimum bar rather than a current ranking; and if Aider auto-selects OpenRouter, a free OpenRouter model has its own rate limits (our OpenRouter free models breakdown explains them).
Fast fixes: command not found, run python -m aider; ImportError, reinstall with aider-install or uv; edit errors, /drop files, then try --edit-format whole or --architect; output limit, ask for smaller changes.
FAQ
Is Aider free?
Aider itself is open source and free to install. What you pay for is the model: your provider bills you for API usage, or you run a local model through something like Ollama at no API cost.
Why does Aider keep picking a model I didn't choose?
Without --model, it chooses based on whichever API keys it finds in your environment, .env files and config. Pass --model explicitly, or remove stray keys from a .env file in your home directory.
How do I report a bug so it gets fixed quickly?
Open an issue on Aider's GitHub (or ask in its Discord) and paste the announcement lines from startup, which include the Aider version and the model and edit format you used.
Start with the announcement lines, fix one layer at a time, and most Aider errors take minutes rather than an afternoon.
Image credits: one frame from the official demo video on aider.chat and three screenshots of the public Aider documentation, all at the end of this post.
Last verified: 2026-10-28
Sources:
Aider docs: Troubleshooting
Aider docs: File editing problems
Aider docs: Token limits
Aider docs: Dependency versions
Aider docs: Aider not found
Aider docs: Models and API keys
Aider docs: Model warnings
Aider docs: API keys
Aider docs: Installation
Aider docs: Chat modes
Aider docs: Ollama
Aider docs: Git integration
PyPI: aider-chat
댓글
댓글 쓰기