Skip to content
Latchkey

GitLab "configuration is invalid: variable" Errors

GitLab rejected the config because a variables entry is malformed - the wrong type, an invalid name, or a value that is not a string or expandable scalar.

What this error means

Validation fails naming the variables block: a value that should be a string is a map or list, or a variable name uses characters GitLab does not allow. No pipeline runs until it is fixed.

gitlab-ci
This GitLab CI configuration is invalid:
variables config should be a hash of key-value pairs, value can be a hash

Common causes

Non-string or malformed value

A variable value given as a raw list, or a nested map missing the value: key when using the descriptive form, fails the schema.

Invalid or reserved variable name

Variable names must match GitLab's allowed pattern. A name with spaces, leading digits, or an illegal character is rejected.

How to fix it

Use string values (or the descriptive hash form)

.gitlab-ci.yml
variables:
  DEPLOY_ENV: "staging"
  TIMEOUT: "30"
  REGION:
    value: "us-east-1"
    description: "Deployment region"

Fix the variable names

  1. Use only letters, digits, and underscores; do not start a name with a digit.
  2. Quote numeric or boolean-looking values so they stay strings.
  3. Re-validate in the Pipeline Editor after correcting names and types.

How to prevent it

  • Always quote numeric and boolean variable values.
  • Keep variable names alphanumeric with underscores.
  • Validate the variables block in the editor before merging.

Related guides

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