Skip to content
Latchkey

Git LFS "wrong number of objects" / Corrupt Pointer in CI

Git LFS found a tracked file whose pointer is malformed, so it cannot map it to a stored object. Usually a binary file was committed without LFS, or a merge/edit mangled the pointer text.

What this error means

An LFS operation fails with pointer file is invalid or Error: wrong number of objects, naming a tracked path. The file’s pointer does not match the expected version/oid/size format LFS requires.

git lfs output
assets/logo.png: pointer file is invalid
error: failed to fetch some objects from
'https://github.com/org/repo.git/info/lfs'

Common causes

A binary committed without LFS

A file matching an LFS track pattern was committed as raw binary (LFS not installed at commit time), so its "pointer" is actually file content LFS cannot parse.

A pointer mangled by a merge or edit

Editing a pointer file by hand or a bad merge can corrupt the version/oid/size lines, leaving an invalid pointer LFS rejects.

How to fix it

Find and re-track the offending files

Identify invalid pointers and migrate the real content into LFS so the pointers are regenerated correctly.

Terminal
git lfs ls-files          # list tracked files and their state
git lfs migrate import --include="assets/*.png" --everything

Repair a single corrupt pointer

  1. Restore the file from a good commit, or re-add it with LFS installed.
  2. Confirm .gitattributes tracks the path so future commits become pointers.
  3. Verify with git lfs pointer --check --file=<path>.

How to prevent it

  • Install Git LFS before committing tracked binaries.
  • Keep .gitattributes patterns accurate and committed.
  • Never hand-edit or merge-resolve LFS pointer files manually.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →