{"record":{"id":"6792b1e339b8c64b","repo":"gastownhall/beads","slug":"errexec","errorCode":"ErrExec","errorMessage":"exec error","messagePattern":"exec error","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dolt/errors.go","lineNumber":31,"sourceCode":"\t\"github.com/steveyegge/beads/internal/storage\"\n\t\"github.com/steveyegge/beads/internal/storage/dberrors\"\n)\n\n// Sentinel errors for the dolt storage layer.\n// These complement the storage-level sentinels (storage.ErrNotFound, etc.)\n// with dolt-specific error types.\nvar (\n\t// ErrTransaction indicates a transaction begin/commit/rollback failure.\n\tErrTransaction = errors.New(\"transaction error\")\n\n\t// ErrQuery indicates a database query failure.\n\tErrQuery = errors.New(\"query error\")\n\n\t// ErrScan indicates a failure scanning database rows into Go values.\n\tErrScan = errors.New(\"scan error\")\n\n\t// ErrExec indicates a database exec (INSERT/UPDATE/DELETE) failure.\n\tErrExec = errors.New(\"exec error\")\n\n\t// ErrDanglingReference indicates that the pre-push integrity check detected\n\t// missing chunks in the local Dolt noms store. The push was aborted to\n\t// prevent propagating the corruption to the remote. Run bd dolt verify\n\t// to diagnose and recover.\n\tErrDanglingReference = errors.New(\"dangling chunk reference\")\n\n\t// ErrFSCKTimeout indicates that the pre-push integrity check (dolt fsck) did\n\t// not complete within the configured timeout. The push was aborted without\n\t// verifying chunk integrity — the store is not necessarily corrupt. Large\n\t// stores can be shrunk with `dolt gc` (or `CALL DOLT_GC()` on a running\n\t// sql-server); the timeout can be raised via the BEADS_FSCK_TIMEOUT\n\t// environment variable.\n\tErrFSCKTimeout = errors.New(\"pre-push integrity check timed out\")\n\n\t// ErrCommitIndeterminate is the storage-wide no-replay sentinel. Keep this\n\t// alias for server-Dolt callers while embedded Dolt returns the same value.\n\tErrCommitIndeterminate = storage.ErrCommitIndeterminate","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dolt/errors.go#L13-L49","documentation":"ErrExec is the sentinel error for a failed database exec (INSERT/UPDATE/DELETE) in the Dolt storage layer. It is produced by wrapExecError, which translates low-level SQL driver failures into this classified sentinel so callers can branch on it via errors.Is. It signals that a write statement against the Dolt database did not succeed.","triggerScenarios":"Any SQL write path (issue insert/update/delete, dependency writes) fails at the driver level — connection loss, syntax/schema mismatch, constraint violation, or server unavailability — and wrapExecError classifies it as ErrExec.","commonSituations":"Dolt sql-server restarted or was reaped mid-write; autocommit disabled writes never committed; schema drift after upgrading beads; disk-full or permissions issues on the server host.","solutions":["Check the wrapped underlying error for the root cause (errors.Unwrap / %w chain).","Verify the Dolt server is running and reachable (bd dolt status / server process).","Run bd doctor to diagnose storage health.","If schema-related, re-run migrations or bd bootstrap to repair the database."],"exampleFix":"// before\nif err := store.InsertIssue(ctx, iss); err != nil {\n    log.Fatal(err)\n}\n// after\nif err := store.InsertIssue(ctx, iss); err != nil {\n    if errors.Is(err, dolt.ErrExec) {\n        log.Fatalf(\"write failed: %v — check dolt sql-server health\", err)\n    }\n    log.Fatal(err)\n}","handlingStrategy":"try-catch","validationCode":"// Go has no pre-call check; verify server reachability first\nif err := db.PingContext(ctx); err != nil { /* server down */ }","typeGuard":null,"tryCatchPattern":"if err := store.InsertIssue(ctx, iss); err != nil {\n    if errors.Is(err, dolt.ErrExec) {\n        // handle write failure: inspect %w chain, retry or report\n    }\n}","preventionTips":["Monitor Dolt sql-server health and restarts","Keep schema migrations in sync with the beads version","Watch disk space on the server host"],"tags":["database","dolt","storage","sql-exec"],"backgroundTag":"database-write-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}