Skip to content
Latchkey

GitLab CI "script ... exceeds the maximum size" - Inline Script Too Large

GitLab limits the size of inline job scripts written into .gitlab-ci.yml. Very large inline blocks (long heredocs, embedded programs) can exceed the limit and fail pipeline creation.

What this error means

Pipeline creation fails reporting that a job script exceeds the maximum allowed size, naming the oversized job.

gitlab-ci
This GitLab CI configuration is invalid:
jobs:deploy:script config exceeds the maximum size limit

Common causes

Huge inline script block

Embedding a large program or long heredoc directly in script bloats the YAML beyond the limit.

Generated YAML with inlined content

A generator that inlines file contents into script can blow past the cap.

How to fix it

Move logic into a committed script file

Keep the YAML small by calling a checked-in shell script.

.gitlab-ci.yml
deploy:
  script:
    - chmod +x ci/deploy.sh
    - ci/deploy.sh

Split the job

  1. Break one giant job into smaller jobs with focused scripts.
  2. Store reusable logic in scripts under a ci/ directory.
  3. Re-validate the file size in the Pipeline Editor.

How to prevent it

  • Keep job scripts thin; call committed shell scripts for real logic.
  • Avoid inlining file contents into YAML.
  • Review generated pipelines for size before pushing.

Related guides

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