Skip to main content

ComfyUI "MetadataIncompleteBuffer" / "HeaderTooLarge" loading a safetensors — fix

Also seen as: "MetadataIncompleteBuffer", "HeaderTooLarge", "SafetensorError while deserializing header", "safetensors truncated"

Direct answer

How do I fix "MetadataIncompleteBuffer / HeaderTooLarge (truncated safetensors)"?

This means the .safetensors file is truncated — the download did not finish. safetensors reads an 8-byte header-length prefix and then expects exactly that many bytes; when the file is cut short it fails at load with MetadataIncompleteBuffer or HeaderTooLarge. The file is on disk and looks present, but it is incomplete.

Key facts

  • iThe model download was interrupted or timed out — common on large checkpoints over a flaky link or a CDN redirect.
  • iThe download tool reported success on a partial file (exit codes are unreliable through HuggingFace CDN redirects).
  • iThe disk filled mid-download, leaving a half-written file.
  • iA size-only validator passed a file that is roughly the right size but content-truncated.

Next step

  1. 1Delete the file and re-download it — a truncated safetensors cannot be repaired, and it stays cached until you remove it.
  2. 2Verify the real source size: curl -sI -r 0-0 -L '<url>' returns the full length in Content-Range (the -L matters — HF /resolve/ 302-redirects to a CDN). Compare it to the on-disk byte size.
  3. 3Use a downloader that resumes and validates (aria2c with retries), not a plain fetch that can silently stop.
  4. 4If it keeps truncating, check free disk — a full volume cuts the write short every time.

Not a fit when

  • Occasionally the file is complete but corrupt rather than truncated — that surfaces as opaque CUDA errors or NaN output downstream, not MetadataIncompleteBuffer. Same fix: delete and re-download.

Not sure this workflow will run before you rent a GPU?

Paste your ComfyUI workflow JSON into the free checker — it flags missing nodes, model requirements, and the VRAM/GPU you actually need. No signup.

Other ComfyUI errors

Frequently Asked Questions

What causes "MetadataIncompleteBuffer / HeaderTooLarge (truncated safetensors)" in ComfyUI?

The model download was interrupted or timed out — common on large checkpoints over a flaky link or a CDN redirect.

How do I fix "MetadataIncompleteBuffer / HeaderTooLarge (truncated safetensors)"?

Delete the file and re-download it — a truncated safetensors cannot be repaired, and it stays cached until you remove it. Verify the real source size: curl -sI -r 0-0 -L '<url>' returns the full length in Content-Range (the -L matters — HF /resolve/ 302-redirects to a CDN). Compare it to the on-disk byte size.