Home / AI & GenAI

AI & GenAITroubleshootingBeginner

vLLM returns 404 'The model does not exist': served model names, LoRA adapter names and client base URLs

The vLLM server is up but clients get 404. Match the model field to /v1/models, fix the base URL, register LoRA adapters correctly and stop replicas disagreeing about names.

Deepak Bhardwaj7 min read

Applies tovLLM OpenAI-compatible server (vllm serve), OpenAI Python SDK 1.x, LiteLLM and Open WebUI as clients; error text varies by vLLM version

Symptom

The vLLM pod is healthy and /health returns 200, but chat calls fail with a 404. There are two different 404s, and telling them apart is the first step:

{"error": {"message": "The model `llama-3.1-8b` does not exist.", "type": "NotFoundError", "code": 404}}
{"detail": "Not Found"}

The first one comes from vLLM: the server got your request but has no model by that name. The second comes from the web framework: the URL path is wrong, so the request never reached a vLLM handler. The exact JSON layout differs between vLLM versions, but the wording "does not exist" and {"detail":"Not Found"} are the useful markers.

Quick map

What you see Likely cause Fix
The model 'X' does not exist model field doesn't match any served name Use a name from /v1/models, or add an alias with --served-model-name
Same error after switching to a local model path Default served name is now the path, e.g. /models/llama Set --served-model-name explicitly
{"detail":"Not Found"} Base URL missing /v1, or /v1 added twice Set the SDK base_url to http://host:8000/v1
404 only for the adapter name LoRA adapter not registered, or LoRA not enabled Start with --enable-lora --lora-modules name=path
404 on some requests, 200 on others Replicas behind one Service run different flags Make every replica serve the same names
404 after a pod restart for an adapter that worked yesterday Adapter was loaded at runtime and not persisted Add it to --lora-modules in the deployment spec

1. Ask the server what it serves

This is the single most useful check. Run it from where the client runs, not only from inside the pod:

curl -s http://vllm.internal:8000/v1/models | jq -r '.data[] | "\(.id)\t\(.parent // "-")"'

Each id is a name the server accepts in the model field. Base models show no parent. LoRA adapters show the base model as their parent. The match is exact and case-sensitive. Llama-3.1-8B-Instruct and meta-llama/Llama-3.1-8B-Instruct are different names.

If the server was started with an API key (--api-key or VLLM_API_KEY), add the header:

curl -s http://vllm.internal:8000/v1/models -H "Authorization: Bearer $VLLM_API_KEY"

Then send the smallest possible request with a name copied from that list:

curl -s http://vllm.internal:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "meta-llama/Llama-3.1-8B-Instruct", "messages": [{"role": "user", "content": "ping"}], "max_tokens": 5}'

If curl works and the app doesn't, the problem is the app's configuration, not vLLM.

2. Fix the served name with --served-model-name

Without --served-model-name, vLLM uses whatever you passed as the model. That's the Hugging Face repo ID when you pull from the Hub, or the full directory path when you serve from a volume. The classic break: the team moves from --model meta-llama/Llama-3.1-8B-Instruct to a pre-downloaded /models/llama-3.1-8b-instruct to speed up cold starts, and every client that sends the repo ID starts getting 404.

Give the model a stable name that clients use, independent of where the weights live:

vllm serve /models/llama-3.1-8b-instruct \
  --served-model-name chat-default meta-llama/Llama-3.1-8B-Instruct \
  --port 8000

--served-model-name accepts several names, and the server answers to any of them. That makes it a clean migration tool. Keep the old name as an alias while clients move to the new one, then drop it.

Two details to know:

  • The first name in the list is the one vLLM returns in the response model field, and it's used as the model_name label on Prometheus metrics. Put the stable name first, or your dashboards change when you add an alias.
  • A neutral name like chat-default lets you swap the weights underneath later without touching clients. Record the actual model and revision in your deployment labels so people can still tell what is running.

Tip

Don't let clients hard-code a model path. Put the served name in configuration (environment variable, Helm value, gateway config) so a rename is one change, not a hunt through repositories.

3. Fix the base URL

{"detail":"Not Found"} means the path is wrong. The OpenAI SDK appends /chat/completions to base_url, so base_url must end in /v1:

from openai import OpenAI

client = OpenAI(base_url="http://vllm.internal:8000/v1", api_key="not-used-or-your-key")
print([m.id for m in client.models.list()])

resp = client.chat.completions.create(
    model="chat-default",
    messages=[{"role": "user", "content": "ping"}],
    max_tokens=5,
)
print(resp.model, resp.choices[0].message.content)

Common mistakes:

Configured base URL Request goes to Result
http://host:8000 /chat/completions 404 Not Found
http://host:8000/v1/ with a client that adds /v1 /v1/v1/chat/completions 404 Not Found
http://host:8000/v1/chat/completions /v1/chat/completions/chat/completions 404 Not Found
http://host:8000/v1 /v1/chat/completions Works

Behind an ingress or gateway that rewrites paths (for example /llm/v1 mapped to /v1), test the full public URL with curl. A rewrite rule that strips one segment too many gives the same Not Found.

Clients that add a provider prefix

Gateways and UIs often carry their own prefix that must not reach vLLM. In LiteLLM the prefix selects the provider and the remainder is sent as the model name:

model_list:
  - model_name: chat-default          # what your apps call
    litellm_params:
      model: hosted_vllm/chat-default # prefix picks the provider; "chat-default" goes to vLLM
      api_base: http://vllm.internal:8000/v1

If vLLM logs show a model name with an unexpected prefix or suffix, the gateway mapping is wrong. Prefix conventions vary by LiteLLM version, so check its documentation for your build. In Open WebUI, the model list comes from /v1/models. If it shows nothing, check the connection URL ends in /v1 and the API key is set.

4. LoRA adapter names

An adapter is only addressable if LoRA is enabled and the adapter is registered:

vllm serve /models/llama-3.1-8b-instruct \
  --served-model-name chat-default \
  --enable-lora \
  --lora-modules ticket-classifier=/adapters/ticket-classifier-v3 \
  --max-lora-rank 16

Clients then send "model": "ticket-classifier". Sending the base name gets the base model with no adapter. That isn't a 404, but it quietly gives different answers, so check resp.model in your tests.

If you load adapters at runtime (VLLM_ALLOW_RUNTIME_LORA_UPDATING=True and POST /v1/load_lora_adapter), the registration lives only in that process. A restart, a reschedule or a new replica won't have it, and requests for it return 404 again:

curl -s -X POST http://vllm.internal:8000/v1/load_lora_adapter \
  -H "Content-Type: application/json" \
  -d '{"lora_name": "ticket-classifier", "lora_path": "/adapters/ticket-classifier-v3"}'

Warning

Runtime adapter loading lets anyone who can reach the endpoint load files from the server's disk. Keep it off in production, or block /v1/load_lora_adapter and /v1/unload_lora_adapter at the ingress and allow only your deploy pipeline.

5. Intermittent 404s across replicas

If roughly one request in N fails, the replicas don't agree. Typical causes are a half-finished rollout, two Deployments sharing a Service selector, or one replica with an adapter loaded at runtime. Ask each pod directly:

for p in $(kubectl get pods -n llm -l app=vllm -o name); do
  echo "== $p"
  kubectl exec -n llm "$p" -- curl -s localhost:8000/v1/models | jq -r '.data[].id'
done

kubectl get endpoints -n llm vllm -o wide
kubectl rollout status deployment/vllm -n llm

Fix the spec so every replica is started with the same --served-model-name and --lora-modules, then let the rollout finish. Most images include curl. If yours doesn't, use kubectl port-forward to each pod instead.

Prevent it next time

  • Always set --served-model-name to a stable alias, and treat a name change like an API change: add the alias first, remove the old one later.
  • Add a readiness or post-deploy check that calls /v1/models and fails if the expected names are missing, not only /health.
  • Register production adapters in --lora-modules in the deployment spec, not at runtime.
  • Keep the base URL and model name in configuration, and add a startup check in each app that confirms its model name appears in /v1/models.
  • Alert on a rise in 404 responses at the ingress or gateway. A wrong name is a config error that retries will never fix.