llama.cppThe model file
invalid magic characters, expected 'GGUF'
The message
gguf_init_from_reader: invalid magic characters: '<xxxx>', expected 'GGUF'
Parts in <angle brackets> change from run to run.
What it means
Every GGUF file starts with the bytes "GGUF" and this one does not. It is usually a web page, a Git LFS pointer or a safetensors file named .gguf.
Why it happens
- The download saved Hugging Face's HTML page (a
/blob/link instead of/resolve/), or a login page for a gated repo. git clonewithout Git LFS left a small text pointer in place of the weights.- The file is in another format (safetensors, PyTorch) and needs converting first. A truncated file reports "failed to read magic" instead.
How to fix it
- Look at the first bytes:
head -c 4 model.ggufmust printGGUF. A tiny file size is the other giveaway. - Download with the Hugging Face CLI:
hf download <repo> <file>.gguf --local-dir . - For safetensors, convert with llama.cpp's
convert_hf_to_gguf.pyfirst.
Guides that cover this
Related errors
Checked against
Message text read from source on 2026-10-26.