-
Notifications
You must be signed in to change notification settings - Fork 0
Troubleshooting
This guide helps you resolve common issues when using GitLab CI Lint.
Problem: Your personal access token is invalid or has expired.
Solutions:
- Generate a new token in GitLab (User Settings → Access Tokens)
- Ensure the token has
read_apiscope - Update your configuration:
gitlab-ci-lint setup # Re-run setup wizard # or manually update ~/.tools-config/.gitlab-ci-lint/config.yaml
- Or override with environment variable:
export GCL_TOKEN="glpat-new-token"
Problem: Token lacks required permissions.
Solution: Ensure your token has the read_api scope.
Problem: Instance URL mismatch.
Solution: Verify you're connecting to the correct instance:
gitlab-ci-lint --instance https://gitlab.com .gitlab-ci.yml
# or for self-hosted:
gitlab-ci-lint --instance https://gitlab.example.com .gitlab-ci.ymlProblem: Network connectivity or firewall issues.
Solutions:
- Verify connectivity:
curl https://gitlab.com/api/v4/user
- Check if proxy is required:
export HTTP_PROXY=http://proxy.example.com:8080 export HTTPS_PROXY=http://proxy.example.com:8080
- Increase timeout:
gitlab-ci-lint --timeout 60s .gitlab-ci.yml
Problem: Slow network or large CI file.
Solution: Increase timeout:
gitlab-ci-lint --timeout 120s .gitlab-ci.ymlOr in config file:
gitlab:
timeout: 120sProblem: Syntax error in your .gitlab-ci.yml.
Common Issues:
- Indentation errors (YAML is strict about spaces, no tabs)
-
Unquoted special characters (
:,{,},[,],,,#) - Mismatched brackets/quotes
Example:
# ❌ Wrong (mixed tabs and spaces)
build:
script: echo "test"
# ✅ Correct (consistent spaces)
build:
script: echo "test"Solution: Use a YAML validator in your IDE:
- VS Code: YAML extension
- IntelliJ: Built-in YAML support
- Online: YAML Lint
Problem: Incorrect YAML syntax.
Example:
# ❌ Wrong
job1:
stage: build script: echo "test"
# ✅ Correct
job1:
stage: build
script:
- echo "test"Problem: Unsupported output format specified.
Valid formats: text, json, yaml
# ✅ Correct
gitlab-ci-lint --output text .gitlab-ci.yml
gitlab-ci-lint --output json .gitlab-ci.yml
gitlab-ci-lint --output yaml .gitlab-ci.ymlProblem: Invalid color mode.
Valid modes: auto, always, never
# ✅ Correct
gitlab-ci-lint --color auto .gitlab-ci.yml # Default: detect TTY
gitlab-ci-lint --color always .gitlab-ci.yml # Force colors
gitlab-ci-lint --color never .gitlab-ci.yml # Disable colorsProblem: Configuration file path is incorrect.
Solutions:
- Check default location:
ls ~/.tools-config/.gitlab-ci-lint/config.yaml - Specify config file explicitly:
gitlab-ci-lint --config /path/to/config.yaml .gitlab-ci.yml
- Use environment variable:
export GCL_CONFIG=/path/to/config.yaml
Problem: Invalid project path or ID.
Solutions:
- Verify project exists in GitLab
- Use correct format:
# Project ID (number) gitlab-ci-lint --project 123 .gitlab-ci.yml # Project path (with namespace) gitlab-ci-lint --project group/subgroup/project .gitlab-ci.yml
- Check URL encoding for special characters:
# Project with dots or special chars gitlab-ci-lint --project "my.group/project" .gitlab-ci.yml
Problem: API endpoint path differs for older GitLab versions.
Solution: Ensure GitLab version is 11.0+ (when CI Lint API was introduced).
Problem: File doesn't exist or permission denied.
Solutions:
- Check file exists:
ls -la .gitlab-ci.yml
- Check file path:
gitlab-ci-lint /full/path/to/.gitlab-ci.yml
- Verify read permissions:
chmod +r .gitlab-ci.yml
Problem: Environment differences.
Common causes:
- Missing environment variables in CI config
- Different GitLab instance (CI runner vs. local)
- Token not available in CI environment
Solution: Use CI_JOB_TOKEN in GitLab CI:
lint:
stage: test
script:
- gitlab-ci-lint --token $CI_JOB_TOKEN .gitlab-ci.ymlSee CI/CD Integration Guide for more details.
Problem: Large CI configuration files take time to validate.
Solutions:
- Skip API validation for syntax-only checks:
gitlab-ci-lint --skip-api .gitlab-ci.yml
- Increase timeout:
gitlab-ci-lint --timeout 120s .gitlab-ci.yml
Problem: Network overhead for repeated validations.
Solution: Use local-only validation during development:
# Development: Fast local checks
alias gitlab-ci-lint-dev='gitlab-ci-lint --skip-api'
# Pre-commit: Full validation
gitlab-ci-lint .gitlab-ci.ymlEnable verbose output to diagnose issues:
gitlab-ci-lint --verbose .gitlab-ci.ymlThis shows:
- Token validation steps
- API endpoint URLs
- Network request details
- Warning messages
If you're still stuck:
-
Check the logs: Run with
--verbose -
Verify configuration: Run
gitlab-ci-lint setupto reconfigure -
Test connectivity:
curl -H "PRIVATE-TOKEN: $GCL_TOKEN" https://gitlab.com/api/v4/user -
Report issues:
- GitHub Issues
- Include: gitlab-ci-lint version, GitLab version, error message, and
-verbose output
| Error | Cause | Solution |
|---|---|---|
authentication failed |
Invalid/expired token | Generate new token |
connection refused |
Wrong instance URL or network issue | Check URL and network |
timeout |
Slow network or large file | Increase --timeout
|
404 Not Found |
Project doesn't exist or wrong path | Verify project path/ID |
invalid YAML |
Syntax error in CI file | Fix YAML syntax |
mapping values not allowed |
YAML structure error | Check indentation/colons |
token validation failed |
Insufficient permissions | Add read_api scope to token |