Jadpo is experimental and not ready for production. These docs follow the compiler's main branch as of 5 Nov 2026. What's built · Install 0.3.0
jadpo
ReferenceErrors

ErrorsEntities, stores and migrations · rule

data.reference_cycle

On this page

Two or more entities refer to each other through required fields, so none of their records could ever be created first.

Area 5, Entities, stores and migrations; not declinable; the next step is usually the human's.

Why Jadpo refuses it

A required reference must point at a record that already exists. Here a Team needs its lead, a Member, and a Member needs its Team. The first team can't be created without a member, and the first member can't be created without a team, whatever on_delete: says.

Jadpo won't choose which reference becomes optional, because that decides which record can exist on its own for a while.

What it looks like

main.jadpo:

example
entity Team {    id: Uuid    lead_id: Member.id {        on_delete: OnDelete.restricted    }}entity Member {    id: Uuid    team_id: Team.id {        on_delete: OnDelete.restricted    }}
jadpo checkcheck failed: 1 error, 1 file

error Required references form a cycle through Member

--> main.jadpo:10:5

   | 3 |     lead_id: Member.id {   |     ------- and this one10 |     team_id: Team.id {   |     ^^^^^^^ required reference
reason
Member.team_id and Team.lead_id are both required, so no record could be created first: each needs one that already exists.
next
Make one of these references optional (X.id?) (human)
rule
data.reference_cycle
help
https://jadpo.dev/docs/errors/data.reference_cycle

(human) at the end of the next: line tells your coding agent to stop and ask you which fix you want, because the choice is yours to make: it decides whether a team can be without a lead, or a member without a team.

How to fix it

The question is which record may exist without the other.

If a team may be without a lead, make lead_id optional. An optional reference can also be cleared when its member is deleted:

example
    lead_id: Member.id? {        on_delete: OnDelete.cleared    }

A team is created with no lead, then its members, and then its lead is set. Deleting the lead leaves the team without one.

If a member may be without a team, make team_id optional instead:

example
    team_id: Team.id? {        on_delete: OnDelete.cleared    }

A member is created with no team, then the team with that member as its lead, and then the member joins it. Deleting a team leaves its members without one.

Markdown for agents: /docs/errors/data.reference_cycle.md.Built from Jadpo main at aee2e8f.