{"record":{"id":"32fe6386fd33975c","repo":"gastownhall/beads","slug":"dolt-add-s-w-32fe63","errorCode":null,"errorMessage":"dolt add %s: %w","messagePattern":"dolt add (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/versioncontrolops/commit.go","lineNumber":76,"sourceCode":"\t// — at high-frequency callers (config/metadata heartbeats, reconcile counters,\n\t// idempotent label/dependency writes) this floods the Dolt log.\n\t//\n\t// Cheap fast-path: if NOTHING is pending in the whole working set (excluding\n\t// dolt-ignored tables, which cannot be staged), skip without touching Dolt's\n\t// staging machinery. Note: callers like Update/Close also write an events row,\n\t// so a zero-rows main-table write can still be a real change — dolt_status\n\t// captures that correctly where a rows-affected check would not.\n\tpending, err := issueops.HasPendingChanges(ctx, conn)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"check pending changes before commit: %w\", err)\n\t}\n\tif !pending {\n\t\treturn nil\n\t}\n\n\tfor table := range dirtyTables {\n\t\tif _, err := conn.ExecContext(ctx, \"CALL DOLT_ADD(?)\", table); err != nil {\n\t\t\treturn fmt.Errorf(\"dolt add %s: %w\", table, err)\n\t\t}\n\t}\n\n\t// Precise guard: HasPendingChanges above is global, but we only DOLT_ADD the\n\t// dirty-tracked tables. When those specific tables turn out clean (idempotent\n\t// no-op) while some UNRELATED table is concurrently dirty, the fast-path does\n\t// not fire yet staging stages nothing — so DOLT_COMMIT('-m') would still emit\n\t// the \"nothing to commit\" warning. Check the STAGED set (exactly what '-m'\n\t// will commit) and skip the empty commit.\n\tstaged, err := issueops.HasStagedChanges(ctx, conn)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"check staged changes before commit: %w\", err)\n\t}\n\tif !staged {\n\t\treturn nil\n\t}\n\tif author == \"\" {\n\t\t_, err = conn.ExecContext(ctx, \"CALL DOLT_COMMIT('-m', ?)\", commitMsg)","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/versioncontrolops/commit.go#L58-L94","documentation":"StageAndCommit stages each dirty table with CALL DOLT_ADD(?) and wraps failures as 'dolt add <table>: %w'. Dolt rejects DOLT_ADD for tables that don't exist or names that can't be staged (e.g. dolt-ignored tables). Each failure aborts the remaining staging steps, so dirtyTables is processed in map (non-deterministic) order.","triggerScenarios":"Calling StageAndCommit with a dirtyTables entry naming a nonexistent or dolt-ignored table; DOLT_ADD failing due to connection issues; concurrent session mutating the staging area.","commonSituations":"Caller tracking a table that was since dropped or renamed; adding ignored/virtual tables; stale connections mid-commit; case-mismatched table names on case-sensitive servers.","solutions":["Verify each table in dirtyTables exists and is not dolt-ignored before staging","Filter out stale entries from dirtyTables when tables were dropped/renamed","Inspect the wrapped driver error for the specific table Dolt rejected and remove it from the tracked set"],"exampleFix":"// before\nerr := versioncontrolops.StageAndCommit(ctx, conn, map[string]bool{\"issues\": true, \"dropped_tbl\": true}, msg, \"\")\n// after\ntables := pruneNonexistentTables(ctx, conn, dirtyTables)\nerr := versioncontrolops.StageAndCommit(ctx, conn, tables, msg, \"\")","handlingStrategy":"validation","validationCode":"for table := range dirtyTables {\n    var n int\n    if err := conn.QueryRowContext(ctx,\n        \"SELECT COUNT(*) FROM information_schema.tables WHERE table_name = ?\", table).Scan(&n); err != nil || n == 0 {\n        delete(dirtyTables, table) // drop stale/ignored entries before staging\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only track real, non-ignored tables in dirtyTables","Prune entries when tables are dropped/renamed","Match table-name casing exactly as created","Stage and commit on a stable, dedicated connection"],"tags":["dolt","sql","commit","staging"],"backgroundTag":"dolt-staging-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}