Skip to content
Latchkey

GitLab "This GitLab CI configuration is invalid"

GitLab validated .gitlab-ci.yml before creating a pipeline and rejected it. The banner is generic - the real diagnosis is the specific message after the colon.

What this error means

No pipeline runs at all. The commit, MR, or Pipeline Editor shows a red "This GitLab CI configuration is invalid" banner with a one-line reason. Until the file validates, GitLab refuses to create any pipeline.

Pipeline Editor / CI lint
This GitLab CI configuration is invalid: jobs:test:script config should be a string or a nested array of strings up to 10 levels deep

Common causes

A key has the wrong shape

A keyword was given a value of the wrong type - a mapping where a string was expected, a list where a scalar was expected. GitLab’s schema is strict and names the exact path (jobs:test:script).

A typo in a reserved keyword

Misspelling scripts: for script:, onlys: for only:, or artifact: for artifacts: makes GitLab treat it as an unknown key and reject the file.

No visible jobs after parsing

If everything resolves to hidden jobs or templates, GitLab reports the config invalid because there is nothing to run.

How to fix it

Read the detail and validate in the Pipeline Editor

The text after "invalid:" names the exact job and key. Open CI/CD → Editor (or Pipelines → CI lint) - it points at the offending line.

  1. Copy the message after the colon - it names the job and keyword path.
  2. Open CI/CD → Editor; the "Validate" tab re-runs the same linter on your current ref.
  3. Fix the named key, then confirm the editor shows "Pipeline syntax is correct".

Lint via the API before pushing

Validate the merged configuration (includes resolved) without a commit.

Terminal
curl --header "PRIVATE-TOKEN: $TOKEN" \
  "https://gitlab.com/api/v4/projects/$ID/ci/lint?include_merged_yaml=true" \
  --data-urlencode "content@.gitlab-ci.yml"

How to prevent it

  • Edit pipeline config in the Pipeline Editor, which validates live.
  • Add a gitlab-ci schema to your IDE for inline keyword checking.
  • Run the ci/lint API in a pre-push hook for complex configs.

Related guides

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