{"record":{"id":"0cef6ae4fef5163d","repo":"gastownhall/beads","slug":"failed-to-commit-dependency-removals-w","errorCode":null,"errorMessage":"failed to commit dependency removals: %w","messagePattern":"failed to commit dependency removals: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/doctor/fix/validation.go","lineNumber":209,"sourceCode":"\t\tcase \"dependencies\":\n\t\t\t_, err = tx.Exec(\"DELETE FROM dependencies WHERE issue_id = ? AND \"+fixDependencyTargetExpr+\" = ? AND type = ?\", d.issueID, d.dependsOnID, d.depType)\n\t\tcase \"wisp_dependencies\":\n\t\t\t_, err = tx.Exec(\"DELETE FROM wisp_dependencies WHERE issue_id = ? AND \"+fixDependencyTargetExpr+\" = ? AND type = ?\", d.issueID, d.dependsOnID, d.depType)\n\t\tdefault:\n\t\t\tfmt.Printf(\"  Warning: skipped child→parent dependency from unexpected table %s\\n\", d.depTable)\n\t\t\tcontinue\n\t\t}\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"  Warning: failed to remove %s→%s: %v\\n\", d.issueID, d.dependsOnID, err)\n\t\t} else {\n\t\t\tremoved++\n\t\t\tif showIndividual {\n\t\t\t\tfmt.Printf(\"  Removed child→parent dependency: %s→%s\\n\", d.issueID, d.dependsOnID)\n\t\t\t}\n\t\t}\n\t}\n\tif err := tx.Commit(); err != nil {\n\t\treturn fmt.Errorf(\"failed to commit dependency removals: %w\", err)\n\t}\n\n\t// Commit changes in Dolt\n\t_, _ = db.Exec(\"CALL DOLT_COMMIT('-Am', 'doctor: remove child-parent dependency anti-patterns')\") // Best effort: commit advisory; schema fix already applied in-memory\n\n\tfmt.Printf(\"  Fixed %d child→parent dependency anti-pattern(s)\\n\", removed)\n\treturn nil\n}\n\n// CrossTableDuplicates removes issues-table rows whose IDs also exist in the\n// wisps table. The wisps copy is canonical (be-iabdi); stale issues rows are\n// deleted along with their child rows (labels, events, dependencies, comments).\nfunc CrossTableDuplicates(path string, verbose bool) error {\n\tbeadsDir, err := resolvedWorkspaceBeadsDir(path)\n\tif err != nil {\n\t\treturn err\n\t}\n","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/doctor/fix/validation.go#L191-L227","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := tx.Commit(); err != nil {\n    _ = tx.Rollback() // release server-side state best-effort\n    return fmt.Errorf(\"failed to commit dependency removals: %w\", err)\n}","preventionTips":["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"],"tags":["database","transaction","commit","dolt"],"backgroundTag":"transaction-commit-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}