Skip to content
Latchkey

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.

CircleCI UI
Config is invalid:
  - workflow 'ci': circular dependency detected among jobs:
    build -> test -> build

Common 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

.circleci/config.yml
workflows:
  ci:
    jobs:
      - build
      - test:
          requires: [build]
      - deploy:
          requires: [test]   # no edge back to build/test

Trace and remove the back-edge

  1. Write out each job’s requires: and follow the edges until you find the loop.
  2. Remove or redirect the edge that points back upstream.
  3. Re-run circleci config validate to 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.

Related guides

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