Skip to content
Latchkey

GitLab CI "Preparation failed: file too large" - Artifacts Over Max

GitLab enforces a maximum artifact size per job. When the uploaded artifacts exceed the instance or project limit, the runner reports the upload failed because the file is too large.

What this error means

The job fails at artifact upload with a too-large or 413-style message, naming the artifact that exceeded the maximum size.

gitlab-ci
ERROR: Uploading artifacts as "archive" to coordinator... too large archive
id=12345 responseStatus=413 Request Entity Too Large
FATAL: too large

Common causes

Artifact set exceeds the max size

The total uploaded artifacts exceed the instance maximum_artifacts_size limit.

Including build caches or node_modules

Accidentally capturing large directories like node_modules or build caches bloats the artifact.

How to fix it

Narrow the artifact paths

Upload only what downstream jobs need and exclude heavy directories.

.gitlab-ci.yml
build:
  artifacts:
    paths:
      - dist/
    exclude:
      - dist/**/*.map

Raise the limit or split outputs

  1. For self-managed, raise maximum_artifacts_size in admin settings if appropriate.
  2. Split large outputs across multiple jobs or use external object storage.
  3. Compress before uploading where it helps.

How to prevent it

  • Scope artifacts:paths tightly to required outputs.
  • Exclude caches, maps, and node_modules from artifacts.
  • Monitor artifact sizes against the instance limit.

Frequently asked questions

What causes ""file too large" artifacts"?
The total uploaded artifacts exceed the instance maximum_artifacts_size limit.
How do I fix "file too large" artifacts?
Upload only what downstream jobs need and exclude heavy directories.

Related guides

References

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