# Claude Code 'There's an Issue With the Selected Model': It's Usually Just a 404

> I pointed Claude Code at a fake API and fed it every kind of error. Any 404 — a typo, a stray /v1, a gateway's error page — produced this exact message. Here's how to tell which one you have.

By Tahir Nazir · Published 2026-10-06 · Updated 2026-10-08
Canonical: https://www.its-tahir.com/blog/claude-code-issue-with-the-selected-model

**My test result: Claude Code turns every HTTP 404 into "There's an issue with the selected model."** A wrong model name, a wrong URL, and a proxy's generic error page all look identical, so often the model was never the problem.

It's one of the most-reported errors in Claude Code. There are over 90 GitHub issues containing it:

```text
There's an issue with the selected model (claude-sonnet-5-5). It may not exist or
you may not have access to it. Run /model to pick a different model.
```

It reads like a verdict on the model. So people do what it says: they switch models, re-check their plan, log out and in, and file a ticket about access. Here's the test, how to find which 404 you have, and the fixes for each.

## How I tested it

I installed Claude Code **2.1.291**, the current release, into a temp folder. Then I ran it against a **fake API server** on my own machine that returns whatever error I tell it to and logs exactly what Claude Code sent. It ran with a dummy API key and an empty config folder, so no request ever reached Anthropic. This was on Windows 11.

Each test used non-interactive mode (`claude -p`), which is why the message says `Run --model` rather than `Run /model`. Anthropic's docs note the hint changes by surface.

| Test | What the server did | What Claude Code showed |
| --- | --- | --- |
| Typo: `--model sonet` | 404, "model not found" | **There's an issue with the selected model (sonet)** |
| Gateway URL ending in `/v1` | 404 on `/v1/v1/messages` | **There's an issue with the selected model (claude-sonnet-5-5)** |
| Proxy's HTML error page | 404, `<h1>404 Not Found</h1>` | **There's an issue with the selected model (claude-sonnet-5-5)** |
| Wrong permissions | 403 | `Failed to authenticate. API Error: 403 …` |
| Bad API key | 401 | `Invalid API key · Fix external API key` |
| Bad request | 400 | `API Error: 400 …` |
| Server error | 500 | `API Error: 500 … check your inference gateway` |

Three completely different problems, one message. In the second and third rows, the model was fine: `sonnet` resolved correctly to `claude-sonnet-5-5`, and that's what the server received.

Every other status kept its own, accurate message. **The disguise is specific to 404.** If you see this error, read it as *"the server answered 404"* and work out why.

## Step 1: see what actually happened

The error throws away the useful detail, but the debug log keeps it. Run the same thing with `--debug`:

```bash
claude --debug
```

Then open the newest file in `~/.claude/debug/`. For the stray `/v1` test, the log said:

```text
[DEBUG] [API REQUEST] /v1/v1/messages source=sdk
[ERROR] API error (attempt 1/1): 404 404 <h1>404 Not Found</h1>
[WARN] Streaming endpoint returned 404, falling back to non-streaming mode
[ERROR] Non-streaming fallback also failed: 404 <h1>404 Not Found</h1>
```

Two lines tell you nearly everything:

- **The path.** Anything other than `/v1/messages` means your base URL is wrong.
- **The reply.** An HTML page (`<h1>404 Not Found</h1>`) came from a web server or proxy, not the model API. A JSON `not_found_error` that names the model is a genuine model problem.

The warning in the middle explains something else people notice: each failure makes **two** requests, because the CLI retries a failed streaming request without streaming.

## Cause 1: the model name is wrong or stale

This is the case Anthropic's docs describe: *"The configured model name was not recognized or your account lacks access to it."*

**A typo.** On 2.1.291, a misspelled name did produce an early clue in non-interactive mode, before the error:

```text
"sonet" isn't described by this version's model catalog; update Claude Code, or map it ...
```

If you see that line, stop there — it's the name. In interactive sessions, though, one [open report](https://github.com/anthropics/claude-code/issues/99578) says a typo shows no warning at all: the header and `/status` display it like a real model until your first prompt fails.

**A stale value set somewhere you forgot.** The model can come from five places, highest priority first:

1. `/model` during the session
2. `claude --model …` at startup
3. The `ANTHROPIC_MODEL` environment variable
4. The `model` field in a settings file
5. `ANTHROPIC_DEFAULT_MODEL`, the default for new sessions

If the wrong model keeps coming back, it's in one of these. A shell profile exporting `ANTHROPIC_MODEL` from months ago is the usual culprit. One user's [scheduled tasks failed on every run](https://github.com/anthropics/claude-code/issues/90652) naming an OpenRouter model they'd configured once and removed — it had been saved somewhere the task still read.

**The fix Anthropic recommends:** use an alias — `sonnet`, `opus`, `haiku` — rather than a full versioned ID. Aliases *"resolve to a maintained default so they don't go stale."*

## Cause 2: your gateway URL has an extra /v1

If you route Claude Code through an LLM gateway, LiteLLM, a company proxy or a router, this is the first thing to check. It's exactly what happened in [issue #97393](https://github.com/anthropics/claude-code/issues/97393), and my test reproduced it.

Claude Code adds `/v1/messages` itself. So `ANTHROPIC_BASE_URL` should stop **before** `/v1`:

```bash
# Wrong — requests go to /v1/v1/messages
export ANTHROPIC_BASE_URL=https://gateway.example.com/v1

# Right
export ANTHROPIC_BASE_URL=https://gateway.example.com
```

The same applies to path-based gateways: if the gateway serves `/provider/v1/messages`, the base URL is `https://gateway.example.com/provider`.

In #97393, the model ID had a `[1m]` suffix, and that's what the user suspected first — *"the obvious suspect and the wrong one,"* as they put it. The message points you at the model, so you debug the model. The debug log's path line ends that in seconds.

## Cause 3: something returned a 404 page

If the debug log shows an **HTML** 404, the reply came from something in front of the API, not the model API itself. Common sources:

- A company proxy or firewall answering for a host it doesn't allow
- A gateway route that doesn't exist, or exists under a different path
- A reverse proxy that only forwards some paths

The fix belongs to whoever runs that hop. Show them the path from your debug log, and ask why it returns 404. While you're there, check it passes streamed responses through intact: a gateway that cuts them short is behind a different Claude Code failure, [auto mode's "classifier gave no verdict" error](/blog/claude-code-auto-mode-classifier-no-verdict).

One report, [#94442](https://github.com/anthropics/claude-code/issues/94442), fits this pattern. A Pro user with no custom configuration got this error on every model, while claude.ai worked fine on the same account. The attached error log shows `Error: 404 <h1>404 Not Found</h1>` — the same HTML-page signature as my proxy test, not the API's normal JSON error. That issue is still open and I can't tell you its cause. But the signature says the 404 came from somewhere other than a "this model doesn't exist" check, so switching models was never going to fix it.

## Cause 4: the model in the error isn't the one you chose

A lot of reports — and searches that land on this site — name **`claude-haiku-4-5-20251001`**. If you didn't choose Haiku, there's a likely reason it's in the message.

Anthropic's model docs explain why that's possible. `ANTHROPIC_DEFAULT_HAIKU_MODEL` sets *"the model to use for `haiku`, or background functionality."* Claude Code uses the Haiku slot for background work as well as when you select it. If your gateway, router or third-party provider doesn't serve the default Haiku ID, those requests can 404, and the error names Haiku.

The fix is to pin that slot to something your provider actually serves:

```bash
export ANTHROPIC_DEFAULT_HAIKU_MODEL=<a model ID your gateway serves>
```

The same pattern exists for `ANTHROPIC_DEFAULT_SONNET_MODEL`, `ANTHROPIC_DEFAULT_OPUS_MODEL` and `ANTHROPIC_DEFAULT_FABLE_MODEL`. (`ANTHROPIC_SMALL_FAST_MODEL` is the old, deprecated name for the Haiku one.)

To be clear about what I tested: my non-interactive runs only sent the main model, so I didn't observe a background Haiku request myself. This cause rests on Anthropic's documentation of that variable.

## One case that isn't a 404

**An expired login on an old version.** Before v2.1.206, an expired claude.ai login that couldn't refresh failed every model with this exact error. Newer versions say *Login expired* instead ([what that message means and how to fix it](/blog/claude-code-not-logged-in-login-expired)). If you're on something older, run `/login` — or better, `claude update`.

On Google Cloud, the region and project settings produce their own versions of this problem. I covered those in [Claude Code on Vertex AI: model not found](/blog/claude-code-vertex-ai-model-not-found).

## Two-minute triage

1. **Run with `--debug`** and open the newest file in `~/.claude/debug/`.
2. **Path isn't `/v1/messages`?** Remove the extra `/v1` (or path segment) from `ANTHROPIC_BASE_URL`.
3. **Reply is an HTML page?** Something in front of the API answered. Take the path to whoever runs your proxy or gateway.
4. **Reply is JSON "not found" naming your model?** It's the name. Check the five places a model can be set, and use an alias.
5. **Error names Haiku but you chose something else?** Set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model your provider serves.
6. **None of the above?** Run `claude update`. Clients older than v2.1.206 report an expired login this way.

**Key takeaways**

- In tests on Claude Code 2.1.291, every HTTP 404 became 'There's an issue with the selected model' — a typo, a stray /v1 and a proxy's HTML error page alike. 401, 403, 400 and 500 kept their own messages.
- claude --debug writes the real path and server reply to ~/.claude/debug/. A path other than /v1/messages means a bad base URL; an HTML reply means a proxy or gateway answered, not the model API.
- ANTHROPIC_BASE_URL must stop before /v1 — Claude Code appends /v1/messages itself.
- Errors naming Haiku when you picked another model can come from the background model slot; pin it with ANTHROPIC_DEFAULT_HAIKU_MODEL on gateways and third-party providers.
- Use aliases like sonnet and opus on the Anthropic API, and check the five places a model can be set when a stale ID keeps coming back.

If the debug log points somewhere else entirely, [every Claude Code error and its fix](/blog/claude-code-troubleshooting) lists the other messages and what each one usually means.

If the "something in front of the API" turns out to be a company proxy, its certificate is usually the next thing to break — see [Claude Code behind a corporate proxy](/blog/claude-code-ssl-certificate-corporate-proxy). Getting AI tools working cleanly inside locked-down company networks is a lot of the work I do — [see recent projects](/work).

## FAQ

### What does 'There's an issue with the selected model' mean in Claude Code?

In my tests on Claude Code 2.1.291, it is what any HTTP 404 from the model endpoint turns into. A misspelled model name produces it, but so does a gateway URL with an extra /v1 and a generic HTML 404 page from a proxy — even when the model itself is fine. Other errors such as 401, 403, 400 and 500 keep their own messages.

### How do I see the real error behind it?

Run Claude Code with --debug and open the session's log in ~/.claude/debug/. The request lines show the exact path that was called, such as /v1/v1/messages, and the error lines show the server's real reply, such as an HTML '404 Not Found' page or a JSON not_found_error.

### Why does the error name a Haiku model when I selected Opus or Sonnet?

Claude Code uses the model behind the haiku alias for background work as well as when you select it, and ANTHROPIC_DEFAULT_HAIKU_MODEL controls which model that is. If your gateway or provider doesn't serve the default Haiku ID, those requests can fail and name Haiku. Set ANTHROPIC_DEFAULT_HAIKU_MODEL to a model your provider actually serves.

### Should I use model aliases or full model IDs in Claude Code?

On the Anthropic API, use aliases such as sonnet or opus. Anthropic's docs recommend them because they resolve to a maintained default and don't go stale. Full IDs are for third-party providers and gateways, where you pin exact IDs your deployment serves.

## Sources

- [Error reference: There's an issue with the selected model — Claude Code docs](https://code.claude.com/docs/en/errors)
- [Model configuration — Claude Code docs](https://code.claude.com/docs/en/model-config)
- [Manage costs: background token usage — Claude Code docs](https://code.claude.com/docs/en/costs)
- [Upstream HTTP errors are masked as 'selected model may not exist' (anthropics/claude-code #97393)](https://github.com/anthropics/claude-code/issues/97393)
- [There's an issue with the selected model (claude-haiku-4-5-20251001) (anthropics/claude-code #94442)](https://github.com/anthropics/claude-code/issues/94442)
- [--model value is not verified before use (anthropics/claude-code #99578)](https://github.com/anthropics/claude-code/issues/99578)
- [Scheduled Tasks fail with 'issue with the selected model' (anthropics/claude-code #90652)](https://github.com/anthropics/claude-code/issues/90652)
