{"record":{"id":"95a848fc74502009","repo":"gastownhall/beads","slug":"begin-is-blocked-recompute-w","errorCode":null,"errorMessage":"begin is_blocked recompute: %w","messagePattern":"begin is_blocked recompute: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dolt/store.go","lineNumber":4589,"sourceCode":"\t}\n\tdefer conn.Close()\n\tif err := s.pinStoreBranch(ctx, conn); err != nil {\n\t\treturn 0, err\n\t}\n\treturn s.recomputeAllBlockedWithDB(ctx, conn)\n}\n\n// txBeginner is satisfied by both *sql.DB and *sql.Conn, letting\n// recomputeAllBlockedWithDB run either against a caller-owned pinned\n// *sql.Conn (recomputeAllBlocked) or directly against a *sql.DB (tests).\ntype txBeginner interface {\n\tBeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)\n}\n\nfunc (s *DoltStore) recomputeAllBlockedWithDB(ctx context.Context, db txBeginner) (int, error) {\n\ttx, err := db.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"begin is_blocked recompute: %w\", err)\n\t}\n\t// One shared body across every mode (guard a dirty graph, then recompute):\n\t// the guard refuses to derive and commit is_blocked from uncommitted\n\t// issue/dependency edits, and it runs inside THIS tx so it sees exactly the\n\t// working set the recompute reads (bd-6dnrw.37).\n\tchanged, err := versioncontrolops.GuardedRecomputeAllBlockedInTx(ctx, tx)\n\tif err != nil {\n\t\t_ = tx.Rollback()\n\t\treturn 0, err\n\t}\n\tif err := s.commitSQLTx(ctx, \"commit is_blocked recompute\", tx); err != nil {\n\t\treturn 0, err\n\t}\n\tif changed > 0 {\n\t\t// Stage only issues — the synced table is_blocked lives on (wisps are\n\t\t// dolt_ignore'd) — so an unrelated dirty working set is not swept in.\n\t\tif err := s.doltAddAndCommit(ctx, blockedRecomputeStagedTableList(),\n\t\t\tversioncontrolops.BlockedRecomputeCommitMsg); err != nil {","sourceCodeStart":4571,"sourceCodeEnd":4607,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dolt/store.go#L4571-L4607","documentation":"Wraps a failure of db.BeginTx when starting the transaction for the full is_blocked recompute. Every recompute reads and writes inside a single transaction so the dirty-graph guard and recompute see the same working set; if the transaction cannot begin, the recompute aborts before doing any work.","triggerScenarios":"BeginTx returns an error on the pinned long-timeout connection — the underlying connection went bad (driver.ErrBadConn), the context was canceled before the transaction started, or the Dolt server rejected the new transaction (e.g. shutdown or too many connections).","commonSituations":"Connection sat idle past server wait_timeout and was dropped; Dolt server restart between acquiring the connection and beginning the tx; context deadline exceeded.","solutions":["Retry the recompute — a fresh connection will be acquired","Check the wrapped cause for context cancellation and increase the timeout","Verify Dolt server is up and accepting connections","If ErrBadConn recurs, confirm the server's idle timeout is not shorter than bd's long-timeout setting"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Ensure the connection is alive before beginning work\nif err := conn.PingContext(ctx); err != nil {\n    // re-acquire the connection; the old one is bad\n}","typeGuard":null,"tryCatchPattern":"if err := store.RecomputeAllBlocked(ctx); err != nil {\n    if strings.Contains(err.Error(), \"begin is_blocked recompute\") {\n        // transient: retry once with a fresh connection\n        time.Sleep(time.Second)\n        err = store.RecomputeAllBlocked(ctx)\n    }\n    return err\n}","preventionTips":["Set server wait_timeout longer than bd's long-timeout window","Start the transaction promptly after acquiring the connection","Avoid context deadlines shorter than the recompute duration"],"tags":["dolt","transaction","recompute","connection"],"backgroundTag":"begin-transaction-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}