gastownhall/beads · error
failed to commit dependency removals: %w
Error message
failed to commit dependency removals: %w
What it means
After deleting each bad child→parent dependency inside the explicit transaction, ChildParentDependencies calls tx.Commit(). A failure here means none of the removals were persisted and the error is wrapped as "failed to commit dependency removals: %w". The doctor exits with an error instead of printing the "Fixed N" summary.
Source
Thrown at cmd/bd/doctor/fix/validation.go:209
case "dependencies":
_, err = tx.Exec("DELETE FROM dependencies WHERE issue_id = ? AND "+fixDependencyTargetExpr+" = ? AND type = ?", d.issueID, d.dependsOnID, d.depType)
case "wisp_dependencies":
_, err = tx.Exec("DELETE FROM wisp_dependencies WHERE issue_id = ? AND "+fixDependencyTargetExpr+" = ? AND type = ?", d.issueID, d.dependsOnID, d.depType)
default:
fmt.Printf(" Warning: skipped child→parent dependency from unexpected table %s\n", d.depTable)
continue
}
if err != nil {
fmt.Printf(" Warning: failed to remove %s→%s: %v\n", d.issueID, d.dependsOnID, err)
} else {
removed++
if showIndividual {
fmt.Printf(" Removed child→parent dependency: %s→%s\n", d.issueID, d.dependsOnID)
}
}
}
if err := tx.Commit(); err != nil {
return fmt.Errorf("failed to commit dependency removals: %w", err)
}
// Commit changes in Dolt
_, _ = db.Exec("CALL DOLT_COMMIT('-Am', 'doctor: remove child-parent dependency anti-patterns')") // Best effort: commit advisory; schema fix already applied in-memory
fmt.Printf(" Fixed %d child→parent dependency anti-pattern(s)\n", removed)
return nil
}
// CrossTableDuplicates removes issues-table rows whose IDs also exist in the
// wisps table. The wisps copy is canonical (be-iabdi); stale issues rows are
// deleted along with their child rows (labels, events, dependencies, comments).
func CrossTableDuplicates(path string, verbose bool) error {
beadsDir, err := resolvedWorkspaceBeadsDir(path)
if err != nil {
return err
}
View on GitHub (pinned to 71377f2769)
Solutions
- Re-run the doctor fix — since the commit failed atomically, the deps are still there and a fresh run redoes the deletes
- Inspect the wrapped error: connection errors → check/restart `dolt sql-server`; constraint errors → fix conflicting rows first
- Verify disk space and Dolt server logs if storage errors appear
- Keep the doctor session on a stable connection (no aggressive idle timeouts) so long delete loops survive to commit
Defensive patterns
Strategy: try-catch
Try / catch
if err := tx.Commit(); err != nil {
_ = tx.Rollback() // release server-side state best-effort
return fmt.Errorf("failed to commit dependency removals: %w", err)
} Prevention
- Keep the window between Begin and Commit short; avoid interruptions mid-fix
- Ensure adequate disk space and healthy Dolt storage before bulk deletes
- Commit failures roll back atomically — just re-run the fix rather than manual patching
- Watch Dolt server logs during fix runs to catch restarts before commit
When it happens
Trigger: tx.Commit() fails after a sequence of DELETEs — the transaction was implicitly rolled back by an earlier server-side error, the connection dropped during commit, or the Dolt server (possibly in --no-auto-commit mode) refused to finalize the transaction.
Common situations: Dolt server restarted mid-fix losing the open transaction; commit racing a server shutdown; FK or storage errors during commit in Dolt; network interruption between client and server at commit time.
Related errors
- failed to commit dependency key repairs: %w
- failed to commit orphaned dependency removals: %w
- failed to commit cross-table duplicate removals: %w
- ErrTransaction
- failed to begin transaction: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/0cef6ae4fef5163d.
Report an issue: GitHub.