{"record":{"id":"994890d58d761540","repo":"gastownhall/beads","slug":"commit-is-blocked-recompute-w-994890","errorCode":null,"errorMessage":"commit is_blocked recompute: %w","messagePattern":"commit is_blocked recompute: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/versioncontrolops/blocked_recompute.go","lineNumber":81,"sourceCode":"// proxied-server plane, whose every other commit (uow.Tx.Commit) is likewise\n// unauthored; a store that has a configured committer identity passes it.\n//\n// The returned count is meaningful even alongside a non-nil error from the\n// staging step: the rows WERE corrected in the working set, only the history\n// entry failed, and a caller that reported 0 there would be lying about the\n// database it is looking at.\nfunc RecomputeAllBlockedOnConn(ctx context.Context, conn BlockedRecomputeConn, author string) (int64, error) {\n\ttx, err := conn.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"begin is_blocked recompute: %w\", err)\n\t}\n\tchanged, err := GuardedRecomputeAllBlockedInTx(ctx, tx)\n\tif err != nil {\n\t\t_ = tx.Rollback()\n\t\treturn 0, err\n\t}\n\tif err := tx.Commit(); err != nil {\n\t\treturn 0, fmt.Errorf(\"commit is_blocked recompute: %w\", err)\n\t}\n\tif changed > 0 {\n\t\tif err := StageAndCommit(ctx, conn, BlockedRecomputeStagedTables(), BlockedRecomputeCommitMsg, author); err != nil {\n\t\t\treturn changed, err\n\t\t}\n\t}\n\treturn changed, nil\n}\n","sourceCodeStart":63,"sourceCodeEnd":90,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/versioncontrolops/blocked_recompute.go#L63-L90","documentation":"RecomputeAllBlockedOnConn wraps tx.Commit failure as \"commit is_blocked recompute: <cause>\". The recompute succeeded inside the transaction but the commit did not land, so all in-transaction changes are discarded after the implicit rollback. If the cause is a serialization/lock conflict, a retry is appropriate; if it is a connection loss, the transaction outcome may be uncertain.","triggerScenarios":"RecomputeAllBlockedOnConn when tx.Commit fails: connection lost mid-transaction, commit deadlock/conflict with another writer, or server-side rejection at commit time.","commonSituations":"Network partition during a long recompute; competing writers committing to the same is_blocked rows; server restart mid-transaction.","solutions":["Retry the whole RecomputeAllBlockedOnConn call with backoff — the operation is transactional and safe to re-run","Check the wrapped cause for deadlock/conflict messages and stagger competing writers","Verify connection stability (timeouts, keepalives) for long transactions","If uncertain-commit errors appear, verify the resulting rows before retrying"],"exampleFix":"// before\nn, err := vcops.RecomputeAllBlockedOnConn(ctx, conn, \"agent\")\nif err != nil { return err }\n// after\nn, err := vcops.RecomputeAllBlockedOnConn(ctx, conn, \"agent\")\nif err != nil {\n\tif strings.Contains(err.Error(), \"commit is_blocked recompute\") {\n\t\treturn retryWithBackoff(func() error {\n\t\t\t_, e := vcops.RecomputeAllBlockedOnConn(ctx, conn, \"agent\"); return e\n\t\t})\n\t}\n\treturn err\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"_, err := vcops.RecomputeAllBlockedOnConn(ctx, conn, author)\nif err != nil {\n\tif strings.Contains(err.Error(), \"commit is_blocked recompute\") {\n\t\t// transaction rolled back; whole op is safe to retry\n\t\treturn retryWithBackoff(3, func() error {\n\t\t\t_, e := vcops.RecomputeAllBlockedOnConn(ctx, conn, author); return e\n\t\t})\n\t}\n\treturn err\n}","preventionTips":["Retry commit failures — the transactional design makes re-runs safe","Serialize competing recompute jobs with an application-level lock","Set generous connection timeouts for long transactions"],"tags":["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"}