gastownhall/beads · error
db: DependencySQLRepository.Insert: recompute is_blocked: %w
Error message
db: DependencySQLRepository.Insert: recompute is_blocked: %w
What it means
This error wraps a failure from RecomputeIsBlockedInTx, the full mark/unmark recompute run after adding a parent-child dependency edge. Parent-child adds are not monotonic, so a full recompute of affected issues' blocked state is required; if it fails, the insert aborts here.
Source
Thrown at internal/storage/domain/db/dependency.go:216
var affectedIssues, affectedWisps []string
var aerr error
if srcIsWisp {
affectedIssues, affectedWisps, aerr = issueops.AffectedByDepChangeForWispInTx(ctx, r.runner, dep.IssueID, dep.DependsOnID, dep.Type)
} else {
affectedIssues, affectedWisps, aerr = issueops.AffectedByDepChangeInTx(ctx, r.runner, dep.IssueID, dep.DependsOnID, dep.Type)
}
if aerr != nil {
return fmt.Errorf("db: DependencySQLRepository.Insert: affected set: %w", aerr)
}
if dep.Type == types.DepBlocks || dep.Type == types.DepConditionalBlocks {
if err := r.markDirectBlockedSource(ctx, dep.IssueID, srcIsWisp, dep.DependsOnID, targetCol); err != nil {
return fmt.Errorf("db: DependencySQLRepository.Insert: mark is_blocked: %w", err)
}
affectedIssues, affectedWisps = issueops.RemoveSourceFromAffected(dep.IssueID, srcIsWisp, affectedIssues, affectedWisps)
}
if dep.Type == types.DepParentChild {
if err := issueops.RecomputeIsBlockedInTx(ctx, r.runner, affectedIssues, affectedWisps); err != nil {
return fmt.Errorf("db: DependencySQLRepository.Insert: recompute is_blocked: %w", err)
}
// Snapshot only after all derived blocked-state maintenance has completed.
return issueops.RecordDepEventInTx(ctx, r.runner, issueops.EventDepAdd, dep.IssueID, string(dep.Type), dep.DependsOnID, metadata, actor)
}
if err := issueops.MarkIsBlockedInTx(ctx, r.runner, affectedIssues, affectedWisps); err != nil {
return fmt.Errorf("db: DependencySQLRepository.Insert: mark is_blocked (affected): %w", err)
}
// Snapshot only after all derived blocked-state maintenance has completed.
// Never gated on opts.EmitEvent: a structurally-wired edge is as real to a
// replaying consumer as one added by an explicit dep verb.
return issueops.RecordDepEventInTx(ctx, r.runner, issueops.EventDepAdd, dep.IssueID, string(dep.Type), dep.DependsOnID, metadata, actor)
}
// classifyMissingEndpoint names the endpoint behind a foreign-key refusal,
// re-read on the same runner that refused the insert. The driver's message
// names its constraint, but taking identity out of driver prose is the thing a
// typed refusal exists to avoid, so the two endpoints are read back instead —
// only on the refusal path, so a bulk add still pays no probe per edge.View on GitHub (pinned to 71377f2769)
Solutions
- Retry after confirming connectivity; Insert is idempotent for same-type edges.
- Run a full blocked-state recompute/repair (bd doctor or equivalent) to fix partially applied state.
- Verify schema matches the current version.
- Inspect the wrapped driver error.
Defensive patterns
Strategy: retry
Try / catch
if err := repo.Insert(ctx, dep, actor, opts); err != nil {
if strings.Contains(err.Error(), "recompute is_blocked") {
// schedule a full recompute to restore consistent blocked state
}
} Prevention
- Avoid very wide parent-child trees that inflate affected sets.
- Tune driver timeouts for bulk updates.
- Keep schema current.
When it happens
Trigger: Calling Insert with dep.Type = DepParentChild where issueops.RecomputeIsBlockedInTx fails on the computed affected set — driver error, timeout on large sets, or schema mismatch.
Common situations: Very large affected sets causing timeouts; schema drift; connection failure mid-recompute.
Related errors
- db: DependencySQLRepository.Insert: mark is_blocked: %w
- db: DependencySQLRepository.Insert: mark is_blocked (affecte
- recompute is_blocked after close for %s: %w
- recompute is_blocked after delete for %s: %w
- recompute is_blocked after batch delete: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/f25a374169ec3872.
Report an issue: GitHub.