# Dependency link would create a loop (dependency_cycle)

What the GetItDone API problem code dependency_cycle (HTTP 409) means, what causes it, and how to fix it.

- **HTTP status:** 409
- **Problem type URI:** https://nowgetitdone.com/docs/api/problems/dependency-cycle

## What it means

The blocker you tried to record would close a loop: the task you named as the
blocker already waits on the task you were linking it to, directly or through
other tasks. Every task in such a ring would wait on itself forever, so the
link is refused before it is written. The dependency graph a client reads is
therefore always acyclic — you can follow `blocked_by` links without a visited
set.

## Likely causes

- Recording `A is blocked by B` when B is already blocked by A.
- A longer chain closing on itself: A → B → C, then linking C as a blocker of A.
- A bulk import replaying links in an order the source system never validated.

## How to fix

- Read `GET /v1/tasks/{task_id}/dependencies` on both tasks and follow the
  chain — the `detail` names the two tasks whose existing path the link would
  close.
- Remove the existing link that points the other way
  (`DELETE /v1/tasks/{task_id}/dependencies/{blocker_task_id}`), then record
  the new one.
- If both directions genuinely matter, the work is not finish-to-start: split
  one of the tasks so each half has a single direction of dependency.

## Example problem+json

```json
{
    "type": "https://nowgetitdone.com/docs/api/problems/dependency-cycle",
    "title": "Dependency link would create a loop",
    "status": 409,
    "code": "dependency_cycle",
    "detail": "T-42 already blocks T-17 (directly or through other tasks), so T-17 cannot also block it.",
    "request_id": "req_a1b2c3d4"
}
```

## Related

- [API reference](/docs/api-reference/task-dependencies/addTaskDependency)
