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 limitCommon 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.shSplit the job
- Break one giant job into smaller jobs with focused scripts.
- Store reusable logic in scripts under a ci/ directory.
- 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
GitLab CI "jobs:job:rules config should be an array" - rules InvalidFix GitLab CI "jobs:JOB:rules config should be an array of hashes" - a malformed rules block where a rule is…
GitLab CI Pages Job Fails - "public" Directory Not FoundFix GitLab Pages deploys that fail because the pages job produced no public directory - the build wrote outpu…
GitLab "Invalid YAML" / "did not find expected key" in .gitlab-ci.ymlFix GitLab CI "Invalid configuration format" and raw YAML parse errors in .gitlab-ci.yml - bad indentation, t…