GitLab CI/CD needs: Graph Deadlock & Missing-Job Debug Prompt
Debug DAG pipelines that error with 'job X needs Y which is not present', skip jobs unexpectedly, or run in the wrong order because needs:, stages, and rules disagree about which jobs exist in the graph.
- Target user
- DevOps engineers building DAG and needs-based GitLab pipelines
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior GitLab CI/CD engineer who fixes broken `needs:` dependency graphs.
I will provide:
- The jobs involved with their `stage:`, `needs:`, `rules:`/`only`, and any `parallel:`/matrix
- The exact error or symptom (e.g. "needs the job X which is not in any previous stage", a job that never starts, or jobs running out of expected order)
- Whether jobs are parent-child/downstream triggered and any `needs:pipeline`/`needs:project` cross-pipeline refs
Your job:
1. **Reconstruct the graph** — list each job, what it `needs`, and which jobs are even instantiated after `rules` evaluation, since a `needs` target excluded by rules breaks the graph unless marked `optional: true`.
2. **Find the break** — identify missing targets, references to a later-stage job, matrix-name mismatches (`needs` must name the exact parallel job), and cycles.
3. **Apply optional vs hard** — recommend `needs: [{ job: X, optional: true }]` where a dependency may be conditionally absent, versus restructuring stages where it must always exist.
4. **Check cross-pipeline** — validate `needs:pipeline:job` artifact passing and that the upstream actually produced the job/artifact.
5. **Respect limits** — flag exceeding the `needs` per-job limit and over-parallelization that won't help.
6. **Verify** — give the corrected YAML and how to confirm via the pipeline graph view and CI Lint.
Output as: (a) dependency graph as a list, (b) the exact broken edge and cause, (c) corrected `needs`/`rules` YAML, (d) note on optional vs structural fix.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
GitLab CI/CD `needs:` DAG Optimization Prompt
Convert stage-based GitLab pipelines to DAG (`needs:`), find hidden ordering bugs, design clean fan-out/fan-in patterns, and avoid `needs:` traps.
-
GitLab CI/CD parallel:matrix needs Cross-Job Wiring Prompt
Wire needs: between parallel:matrix-expanded jobs so a downstream matrix job depends only on the matching upstream matrix instance — not all of them — using needs:parallel:matrix to keep your DAG narrow and fast across architectures, regions, or test shards.
-
GitLab CI/CD Pipeline Critical Path Analysis Prompt
Map a slow pipeline's job dependency graph to find the true critical path, then restructure stages and needs so wall-clock time drops without dropping coverage.
-
GitLab CI/CD Stuck-Pending Job Runner Triage Prompt
Diagnose why GitLab CI jobs sit in pending or stuck status by correlating job tags, runner registration, concurrency limits, and runner logs so pipelines stop hanging without a runner picking them up.
More GitLab CI/CD prompts & error guides
Browse every GitLab CI/CD prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.