GitLab CI/CD Troubleshooting Guide
Learn how to debug common GitLab CI/CD issues including YAML errors, stuck jobs, runner problems, variable issues, cache and artifact failures, Docker build errors, Kubernetes deployment failures, and security scanning problems.
Table of contents
- Quick answer
- YAML syntax errors
- Jobs stuck in pending
- Runner errors
- Variables and secrets issues
- Artifacts and cache issues
- Docker build errors
- Kubernetes deployment errors
- Security scanning issues
- Debug checklist
- Related Melochip guides
Quick answer
Read the job log first
The job log usually shows the exact command, error message, missing variable, or failed step.
Validate YAML
Use GitLab CI Lint before committing complex .gitlab-ci.yml changes.
Check runner status
If jobs stay pending, check runner availability, runner tags, executor, and project/group runner settings.
Check variables
If deployments or Docker logins fail, check masked/protected variables, branch protection, and variable names.
1. YAML syntax errors
YAML errors are one of the most common GitLab CI/CD problems. A small indentation mistake, wrong quote, or invalid keyword can stop the pipeline from starting.
Common YAML error example
build_job: stage: build script: - echo "Build"
The indentation is inconsistent. Correct version:
build_job: stage: build script: - echo "Build"
| Problem | Cause | Fix |
|---|---|---|
| Pipeline cannot be created | Invalid YAML structure | Validate with CI Lint. |
| Unexpected keyword | Keyword is in the wrong place | Check GitLab YAML reference. |
| Job missing script | Job does not define required commands | Add script or valid job configuration. |
| Wrong indentation | YAML uses spaces, not tabs | Use two spaces consistently. |
2. GitLab job stuck in pending
If a job stays in pending, GitLab created the job but no runner is available to pick it up.
Common reasons
- No active runner is assigned to the project or group.
- Runner tags do not match job tags.
- Runner is offline.
- Runner is paused.
- Runner is locked to another project.
- Protected runner cannot run unprotected branch jobs.
Example tag mismatch
test_job: tags: - docker script: - echo "Testing"
If no runner has the docker tag, this job may stay pending. Either add the tag to a runner or update the job tags.
3. GitLab Runner errors
On an Ubuntu runner host, useful commands include:
gitlab-runner --version sudo gitlab-runner status sudo gitlab-runner list sudo gitlab-runner verify sudo gitlab-runner restart
If the runner service is not active, restart it and check system logs:
sudo systemctl status gitlab-runner sudo journalctl -u gitlab-runner -n 100 --no-pager
4. Variables and secrets issues
If a job works locally but fails in GitLab CI/CD, a missing or protected variable is often the reason.
| Symptom | Possible cause | Fix |
|---|---|---|
| Variable is empty | Wrong variable name | Check exact uppercase/lowercase key. |
| Variable unavailable on branch | Variable is protected | Run on protected branch or change variable scope carefully. |
| Secret appears in logs | Value printed by script | Do not echo secrets; use masked variables where possible. |
| Docker login fails | Registry variables missing | Check registry credentials and variable names. |
| Kubernetes deploy fails | Kubeconfig variable missing or malformed | Use file variable or write kubeconfig safely. |
5. Artifacts and cache issues
Artifacts and cache solve different problems. If you mix them up, pipelines become unreliable.
Artifact not found
Common causes:
- The artifact path is wrong.
- The folder was never created.
- The artifact expired.
- The next job did not download artifacts.
Cache not working
Common causes:
- Wrong cache path.
- Unstable cache key.
- Runner cache storage not configured properly.
- Expecting cache to behave like required build output.
6. Docker build errors
Docker pipeline failures usually come from Docker daemon access, registry authentication, image tags, or Dockerfile problems.
| Error area | Possible cause | Fix |
|---|---|---|
| Docker daemon not available | Docker executor/DinD not configured | Check runner executor and Docker service. |
| Docker login failed | Wrong registry credentials | Check CI_REGISTRY_USER and password/token. |
| Build context too large | Missing .dockerignore | Add .dockerignore . |
| Image push denied | Missing registry permission | Check project registry and token permissions. |
| Image tag overwritten | Using only latest | Use commit SHA or version tags. |
7. Kubernetes deployment errors
Kubernetes deployment failures often happen because of kubeconfig, RBAC permissions, image pull errors, namespace problems, or rollout failures.
Useful kubectl debugging commands
kubectl get pods kubectl get deployment kubectl describe deployment demo-app kubectl rollout status deployment/demo-app kubectl logs deployment/demo-app kubectl get events --sort-by=.metadata.creationTimestamp
Common Kubernetes CI/CD errors
| Error | Meaning | Fix |
|---|---|---|
| Forbidden | CI credential lacks permission | Check RBAC role/service account. |
| ImagePullBackOff | Kubernetes cannot pull image | Check registry credentials and image tag. |
| Context not found | Kubeconfig is wrong | Check kubeconfig variable. |
| Rollout timeout | Pods are not becoming ready | Check pod logs and readiness probes. |
8. Security scanning issues
Security scanning jobs can fail when templates are added incorrectly, the project language is unsupported, lock files are missing, or the container image does not exist before scanning.
- For SAST, confirm the language and analyzer support.
- For dependency scanning, commit lock files where possible.
- For secret detection, rotate real exposed secrets immediately.
- For container scanning, build and push the image before scanning it.
- Review security reports instead of ignoring failed scan jobs.
GitLab CI/CD troubleshooting checklist
| Step | Question | Action |
|---|---|---|
| 1 | Did the pipeline start? | If not, validate YAML and workflow rules. |
| 2 | Is the job pending? | Check runner status and tags. |
| 3 | Did the script fail? | Read the exact job log line. |
| 4 | Are variables available? | Check project/group variables and protection. |
| 5 | Are artifacts missing? | Check artifact paths and expiry. |
| 6 | Did Docker fail? | Check daemon, registry login, Dockerfile, and tags. |
| 7 | Did deployment fail? | Check kubeconfig, RBAC, rollout, and pod logs. |
| 8 | Can you reproduce safely? | Run a smaller test job or sample pipeline. |
Best practices to avoid future issues
- Validate YAML before merging pipeline changes.
- Use clear job names and simple stages.
- Use runner tags intentionally.
- Keep variables organized and documented.
- Use artifacts for required outputs and cache for dependencies.
- Use commit SHA tags for Docker images.
- Use manual protected jobs for production deployment.
- Review failed job logs before changing random settings.
- Keep GitLab Runner updated.
- Document known fixes for your team.
Screenshot checklist
You can add your own screenshots later from a safe test project:
- Pipeline failed job page.
- Job log with sensitive values hidden.
- Runner settings showing active runner and tags.
- CI Lint validation result.
- Artifacts download or missing artifact message.
- Docker build error example with secrets hidden.
- Kubernetes rollout failure example with safe sample names.
- GitLab CI/CD Learning Path
- GitLab CI/CD YAML Syntax Explained
- GitLab Runner Setup on Ubuntu
- GitLab Artifacts vs Cache Explained
- GitLab CI/CD Docker Build Pipeline
- GitLab CI/CD Deploy to Kubernetes
Official references
- GitLab CI Lint documentation
- GitLab Runner documentation
- GitLab CI/CD YAML reference
- GitLab CI/CD debugging documentation
Conclusion
GitLab CI/CD troubleshooting becomes easier when you follow a clear process: validate YAML, check runner status, read job logs, confirm variables, verify artifacts/cache, and debug Docker or Kubernetes steps separately.
Do not guess blindly. The fastest fix usually starts with the exact error message in the job log.
Join the discussion
0 CommentsAsk questions, add context, or share what worked.
More from Melochip Editorial
Learn what Playwright testing is, why modern QA teams use it, how testers can get started, and the major types...
7 min read · Sep 19, 2026
Learn how Kubernetes Deployments and ReplicaSets work with practical YAML, scaling, self-healing, rolling upda...
7 min read · Sep 17, 2026
Learn Kubernetes security best practices with RBAC, Secrets, ServiceAccounts, Pod securityContext, NetworkPoli...
6 min read · Sep 17, 2026Related articles
Troubleshoot Kubernetes issues including Pending Pods, CrashLoopBackOff, ImagePullBackOff, service routing, in...
7 min read · Sep 17, 2026
Learn Linux from the ground up with simple explanations of the kernel, distributions, filesystem, commands, pe...
4 min read · Updated Oct 1, 2026
Learn what Playwright testing is, why modern QA teams use it, how testers can get started, and the major types...
7 min read · Sep 19, 2026
Learn how Kubernetes Deployments and ReplicaSets work with practical YAML, scaling, self-healing, rolling upda...
7 min read · Sep 17, 2026Stay in the loop. Get new Melochip articles
Receive Melochip article updates when new articles are available. Explicit opt-in only.
No comments yet. Start the discussion.