It isn't working: common problems and how to fix them
Slow Ollama, SSH or sign-in failures, rejected keys, busy ports, services that stop, full disks, and unreachable machines. Find the command that diagnoses each problem and see how to fix it.
In this guide
- 01Ollama is slow or the machine feels sluggish
- 02The model won’t load
- 03SSH won’t connect
- 04Account sign-in fails over SSH
- 05The API key is rejected
- 06‘Address already in use’: the port is taken
- 07The service stops when I close the terminal
- 08‘Command not found’ just after installation
- 09The disk is full
- 10The mini-PC is unreachable
- 11The public site doesn’t show my changes
- 12The agent goes in circles or stops halfway through
- 13When none of these symptoms fit
- 14Frequently asked questions
Guide checked 3 months ago: some commands may have changed. Let us know if so.
In short
Common failures usually come down to the same few causes. If Ollama is slow, the context may be too large for GPU memory. Check with ollama ps. If Claude Code, Codex, or an MCP server can't sign in over SSH, the callback points to localhost. Copy the sign-in address or use an SSH tunnel. A rejected key often means a misnamed or unexported variable, or an ANTHROPIC_API_KEY that takes precedence over your subscription. Use ss -ltnp to find what's using a port, and tmux or systemd with enable-linger to keep work running after logout. For a full disk, check models and Docker images. For an unreachable machine, check Tailscale key expiry and sleep settings. If the agent keeps going in circles, start a new session, raise the effort, or give it a more precise instruction.
Do this first: Maintain and update
Something broke. It happens to everyone. The good news is that the same problems come up on most AI mini-PCs, and each has a command to help diagnose it. Find your symptom below (Ctrl+F works well), run the command, and apply the fix.
Ollama is slow or the machine feels sluggish
Likely cause: the context is set too high. The model cache grows with the context window. When it no longer fits in GPU memory, some work moves to the CPU and performance drops sharply.
ollama ps # the PROCESSOR column should read '100% GPU'
If you see 48%/52% CPU/GPU or 100% CPU, you’ve found the problem. Try these fixes in order:
- Lower the context.
OLLAMA_CONTEXT_LENGTH=32768is enough for a coding agent (see The three settings that matter). On a Ryzen AI Max, the default can go up to 256,000 tokens, an easy trap to fall into. - Use a lighter quantization or a smaller model (Choosing a local model).
- Check whether another model is already using the memory.
ollama pslists them all, andollama stop <modèle>unloads one.
If ollama ps says 100% CPU even for a small model, Ollama can’t see the GPU. Check its logs with journalctl -u ollama --since "10 min ago" and look for GPU, ROCm, CUDA, or Vulkan.
The model won’t load
Typical error: model requires more system memory, or the process exits abruptly while loading.
The model won’t fit in available memory. Allow about 0.6 GB per billion parameters at 4 bits, plus the context. On a machine with unified memory, check how much the BIOS or kernel reserves for the GPU. See Choosing hardware. Free up memory (free -h shows how much is available and htop shows what’s using it), or use a smaller version of the model.
SSH won’t connect
Typical error: Permission denied (publickey).
ssh -v vous@mini-pc # verbose mode shows which key SSH tries and why it is rejected
Check these in order:
- The mini-PC is missing your public key. Run
ssh-copy-id vous@mini-pcfrom your computer while password login is still enabled. Otherwise, add the key manually to~/.ssh/authorized_keys. - The permissions are too broad. SSH rejects a key in a directory other users can read. Run
chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keyson the mini-PC. - The username is wrong. Your account on the mini-PC may have a different name from the one on your computer.
See Securing access for the recommended setup.
Account sign-in fails over SSH
Symptom: Claude Code, Codex, or an MCP server tries to open a browser and nothing happens, or the final page says it can’t connect to localhost.
At the end of OAuth sign-in, the browser redirects to http://localhost:PORT. Over SSH, the browser’s localhost is your own computer. The tool waiting for that redirect is on the mini-PC.
When you first launch it, press c to copy the sign-in address. Open it on your computer, then paste the code from the page into the terminal. For an MCP server, use claude mcp login nom-du-serveur. If the localhost redirect fails, set a callback port (--callback-port 8080 when adding the server) and open a tunnel from your computer:
ssh -L 8080:localhost:8080 vous@mini-pc
In OpenCode, /connect offers sign-in by code or key for most providers. For an MCP server, use opencode mcp auth nom-du-serveur with the same ssh -L tunnel if the localhost redirect fails.
codex login --device-auth # enter the code on a web page, no localhost redirect needed
For an MCP server, use codex mcp login nom-du-serveur with an ssh -L tunnel to the callback port if needed.
The API key is rejected
Typical errors: 401, invalid x-api-key, Incorrect API key provided, authentication_error.
Check these in order:
- The variable is available in this terminal.
echo ${ANTHROPIC_API_KEY:0:8}displays the first eight characters without showing the whole key. Empty output? Addexport NOM=valeurto~/.bashrc, then runsource ~/.bashrcor open a new terminal. - The variable name is right. Each tool expects a specific name (
ANTHROPIC_API_KEY,ANTHROPIC_AUTH_TOKEN,OPENAI_API_KEY, or the name set byenv_keyin Codex). The tool only reads the name it expects. - The key has no extra spaces or line breaks. Copying from a document often adds a trailing space.
- The endpoint is right. A key from a Chinese coding plan works only at that plan’s endpoint, and sometimes only in one region. See Chinese LLMs.
- The key is still valid. The provider console will tell you if the key was revoked or expired, or if you’ve hit a spending cap.
‘Address already in use’: the port is taken
Another program is already listening on the port. It’s often an old copy of your own server still in the background.
sudo ss -ltnp 'sport = :8300' # replace 8300 with your port to see the program and its PID
- For a service, run
systemctl --user stop nom-du-service(orsudo systemctl stop …for a system service). - For another process, stop it by its specific PID with
kill 12345. Avoid matching a pattern withpkill. It can catch other programs with the same word in their command line, including the one you’re typing.
The service stops when I close the terminal
Processes tied to an SSH terminal stop when the connection closes. Pick the approach that fits:
- For a work session (such as a long-running agent), use
tmux. Detach with Ctrl+b followed by d. Return withtmux attach. - For a permanent service, use systemd with
loginctl enable-linger "$USER"so it keeps running when you’re logged out. See the full example in Your first project from start to finish.
‘Command not found’ just after installation
The installer put the command in ~/.local/bin, which isn’t in your PATH yet.
echo $PATH | tr ':' '\n' | grep local/bin # no output means the folder is missing from PATH
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
The disk is full
Typical error: No space left on device. Suddenly, databases, logging, and updates all stop working.
df -h / # see how much space is left
sudo du -sh /usr/share/ollama/.ollama/models ~/.ollama/models 2>/dev/null # Ollama models
docker system df # Docker images, containers, and volumes
sudo du -sh /var/log/journal # system logs
Four places to clear space: unused models with ollama rm, dangling images with docker image prune (check broader variants before using them, as they may also delete volumes), logs with sudo journalctl --vacuum-size=500M, and node_modules or .venv folders from old projects. To catch it before it breaks, set up a check that alerts you early. See Knowing when it breaks.
The mini-PC is unreachable
tailscale status # on your computer, check whether the mini-PC appears and how long it has been offline
- The Tailscale key expired. By default, devices must reauthenticate every 180 days. For a server, disable key expiry from the Tailscale admin console (Tailscale).
- The machine went to sleep. Keep server sleep disabled. See System settings.
- It rebooted and is waiting for something. A kernel update or a disk check may be holding it up. Plug in a monitor or connect from another machine on the local network using its local address.
The public site doesn’t show my changes
If your site uses a Cloudflare tunnel with a cache rule, Cloudflare serves the old version until you purge it. Purge the cache after every deploy, from the dashboard or your deployment script, then reload without the browser cache with Ctrl+Shift+R.
The agent goes in circles or stops halfway through
- It repeats the same mistake. Stop it with Esc, give it a hint or another approach, or raise reasoning effort one notch (Choosing a reasoning effort).
- It forgets instructions late in a long session. Ask it to summarize the current state, then start a fresh session (
/clearin Claude Code) or compact the conversation (/compact). - It hits a usage limit. You’ve used up your allowance for the current 5-hour window or the week. Wait for it to reset or switch models. See Claude Code and Codex with other models.
- It refuses to run a command. A permission rule or the sandbox is often responsible. In Claude Code,
/permissionsshows what’s allowed and blocked.
When none of these symptoms fit
0 of 5 steps done Your ticks stay in this browser.
-
Read the full error message
The last line often tells you what failed, and the earlier lines tell you why. Copy the whole message, including the lines above the one in red.
-
Check the logs
Use
journalctl -xefor the system,journalctl --user -u nom-du-servicefor a user service, orjournalctl -u ollamafor Ollama. -
Ask the agent to diagnose in read-only mode
‘Here’s the error and what I was doing. Diagnose it without changing anything, and give me the most likely cause and a command to check it.’
-
Return to a known state
Go back to the last working commit (
git log, thengit stashorgit checkout) or use last night’s backup. Check the backup before rebuilding anything by hand. -
Tell us what's missing
Ran into a problem this page doesn’t cover? The report button at the bottom of every guide sends it straight to us.
All the commands in this guide
Frequently asked questions
Why is Ollama so slow on my machine?
Nine times out of ten, the context is too large. The model cache no longer fits in GPU memory, so some of the work moves to the CPU. Check the PROCESSOR column in ollama ps. Anything below 100% GPU means a substantial slowdown. Lower OLLAMA_CONTEXT_LENGTH (32,000 is enough for a coding agent) or use a smaller model.
How do I sign in to Claude Code or Codex on a server without a browser?
In Claude Code, press c to copy the sign-in address. Open it on your computer and paste the code shown into the terminal. In Codex, codex login --device-auth gives you a code to enter on a web page. For an MCP server whose OAuth redirect to localhost fails, open a tunnel to the callback port with ssh -L.
What does 'address already in use' mean?
Another program is already listening on the port, often an old copy of your own server still running in the background. sudo ss -ltnp 'sport = :8300' shows its name and process ID (PID). Stop it by that ID with kill, or use systemctl stop if it's a service.
Why is Claude Code billing me for API usage when I have a subscription?
An ANTHROPIC_API_KEY in your environment takes precedence over your account sign-in. The /status command shows the active authentication method. Remove the variable from ~/.bashrc, open a new terminal, and restart Claude Code.
My mini-PC is unreachable over Tailscale. What should I check?
Three common causes are an expired node key (180 days by default, with an option to disable expiry for servers in the admin console), a sleeping machine, or a stopped tailscaled service. Plug in a monitor or connect from another machine on the local network and run tailscale status.
Terms in this guide: Context windowAgentTokenQuantizationOllamaROCmCUDAParametersUnified memorySSHClaude CodeCodexMCPCoding planTerminal (command line)systemdTailscaleReasoning effort
Spotted a mistake?
A command stopped working, a price changed?
Tools change every month. Tell me what is wrong in this chapter and I will fix it and update its date.