CircleCI "circular dependency" in requires - Fix Job Graph
A workflow’s requires: edges form a loop, so CircleCI cannot order the jobs. The dependency graph must be a DAG - if A requires B and B (directly or transitively) requires A, the workflow is rejected.
What this error means
Validation fails with "circular dependency detected", naming the jobs in the cycle. The workflow cannot be scheduled because there is no valid order to run the jobs in.
Config is invalid:
- workflow 'ci': circular dependency detected among jobs:
build -> test -> buildCommon causes
Two jobs require each other
A direct cycle - build requires test while test requires build - has no valid run order, so it is rejected.
A transitive loop through several jobs
A longer chain (A→B→C→A) loops back on itself. The cycle may not be obvious when the requires: lines are spread across the workflow.
A copy-paste requires that points at the wrong job
A requires: left pointing at a downstream job after renaming creates an accidental back-edge that closes a loop.
How to fix it
Break the cycle into a linear (or branching) DAG
workflows:
ci:
jobs:
- build
- test:
requires: [build]
- deploy:
requires: [test] # no edge back to build/testTrace and remove the back-edge
- Write out each job’s
requires:and follow the edges until you find the loop. - Remove or redirect the edge that points back upstream.
- Re-run
circleci config validateto confirm the graph is acyclic.
How to prevent it
- Keep the workflow a strict DAG - dependencies only point upstream.
- Review
requires:after renaming or reordering jobs. - Validate config on every PR so a cycle fails before merge.