llama.cppThe model file

llama.cpp: wrong number of tensors

The message

done_getting_tensors: wrong number of tensors; expected <n>, got <m>

Parts in <angle brackets> change from run to run.

What it means

The file holds more or fewer tensors than this llama.cpp expects for its architecture — the file and the program disagree about the model's layout. A sibling message reads "tensor … has wrong shape".

Why it happens

  • The GGUF was converted with a newer llama.cpp than the one loading it (new tensors were added to that architecture).
  • Or the reverse: an old conversion that a newer llama.cpp no longer matches.
  • A vision model's projector (mmproj) file loaded as the main model.

How to fix it

  1. Update llama.cpp (or Ollama / LM Studio) first; that fixes the common case.
  2. If it persists, download the file again from a recent conversion, and make sure -m points at the model, with --mmproj for the projector.

Related errors

Checked against

Message text read from source on 2026-10-26.