Skip to content
Latchkey

pre-commit "check-added-large-files" fails in CI

The check-added-large-files hook from pre-commit-hooks flags any file over its size threshold (default 500 KB). In CI it fails because a large artifact or binary was committed to the repo.

What this error means

The hook prints "Failed" and names a file with its size, for example "app.bin (1234 KB) exceeds 500 KB".

pre-commit
check for added large files.................................Failed
- hook id: check-added-large-files
- exit code: 1

data/model.bin (5321 KB) exceeds 500 KB.

Common causes

A large binary or artifact was committed

A build output, dataset, or media file over the limit was added to git and the hook catches it.

The default threshold is lower than intended

A legitimately larger asset trips the default 500 KB limit that was never raised for the repo.

How to fix it

Remove the large file or track it with LFS

  1. Remove the oversized file from git history or move it to Git LFS.
  2. Add it to .gitignore if it is a build artifact.
  3. Re-run so the hook passes.
Terminal
git rm --cached data/model.bin
git lfs track "data/*.bin"

Raise the limit deliberately if needed

If larger files are expected, set an explicit maxkb via args.

.pre-commit-config.yaml
- id: check-added-large-files
  args: ['--maxkb=1024']

How to prevent it

  • Ignore build artifacts so they are never committed.
  • Use Git LFS for legitimately large assets.
  • Set an explicit --maxkb that matches your repo policy.

Frequently asked questions

What causes ""check-added-large-files" Failed"?
A build output, dataset, or media file over the limit was added to git and the hook catches it.
How do I fix "check-added-large-files" Failed?
Remove the large file or track it with LFS

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card