{"record":{"id":"1e890990f7aba941","repo":"gastownhall/beads","slug":"committing-0041-nonlocal-repair-w","errorCode":null,"errorMessage":"committing 0041 nonlocal repair: %w","messagePattern":"committing 0041 nonlocal repair: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/schema/migration_repairs.go","lineNumber":156,"sourceCode":"// and the paired DOLT_COMMIT (no --skip-empty in the shipped bytes) fails with\n// \"nothing to commit\". Restore the pre-0041 invariant — the four rows 0040\n// leaves — so the frozen DELETE+COMMIT has a real diff again. No-op when those\n// rows are already present (the common path).\nfunc repairPartial0041NonlocalDelete(ctx context.Context, db DBConn) error {\n\tpresent, err := anyNonlocalFrozenRowPresent(ctx, db)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif present {\n\t\treturn nil\n\t}\n\tif _, err := db.ExecContext(ctx,\n\t\t\"INSERT IGNORE INTO dolt_nonlocal_tables (table_name, target_ref, options) VALUES \"+nonlocalFrozenRowsValues); err != nil {\n\t\treturn fmt.Errorf(\"restoring pre-0041 nonlocal rows: %w\", err)\n\t}\n\tif err := commitNonlocalRepair(ctx, db,\n\t\t\"repair: restore pre-0041 nonlocal rows before replay\"); err != nil {\n\t\treturn fmt.Errorf(\"committing 0041 nonlocal repair: %w\", err)\n\t}\n\treturn nil\n}\n\n// ensureWispTablesForMixedBlockedRecompute repairs #4695 (and the identical\n// #4176 clone-skew shape): migration 0047's final recompute block joins\n// wisps/wisp_dependencies unconditionally in a WITH RECURSIVE UPDATE. Those\n// tables are dolt_ignore'd (0019_wisps_dolt_ignore,\n// 0040_ignored_tables_also_nonlocal_tables), so they never sync to a clone,\n// and MigrateUp runs the main sequence (which reaches 0047) before the\n// ignored sequence that (re)creates them locally. Any clone whose\n// schema_migrations cursor arrives below the binary's latest -- the normal\n// window right after a schema bump, before every producer has re-pushed, and\n// also how a pre-1.0 database's stale cursor numbering can treat the main\n// 0020/0021 wisp-creating migrations as already applied -- reaches 0047 with\n// the wisp tables altogether missing: \"Error 1146: table not found: wisps\".\n//\n// 0047's own SQL is frozen (already shipped, content-hashed); create the","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/schema/migration_repairs.go#L138-L174","documentation":"After restoring the pre-0041 rows, the repair commits via commitNonlocalRepair (DOLT_ADD + DOLT_COMMIT --skip-empty). This error wraps failure of that commit — the restored rows could not be staged/committed, typically from a connection drop or Dolt procedure failure.","triggerScenarios":"The INSERT IGNORE succeeded but DOLT_ADD/DOLT_COMMIT failed during the 0041 replay repair: shared sql-server connection interrupted mid-commit; dirty/conflicted working set; server-side procedure error.","commonSituations":"Network flake during bd init; leftover dirty working set from a crashed prior repair; Dolt server incompatibility.","solutions":["Retry bd init — the presence guard makes re-runs clean no-ops once committed","Resolve dirty/conflicted Dolt working-set state before retrying","Confirm the Dolt sql-server is reachable and healthy","Inspect the wrapped underlying error for the exact commit failure"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := commitNonlocalRepair(ctx, db, \"repair: restore pre-0041 nonlocal rows before replay\"); err != nil {\n    if isTransient(err) {\n        return retryRepair(ctx, db) // presence guard makes re-run a no-op once committed\n    }\n    return err\n}","preventionTips":["Retry on transient commit failures — the presence guard makes re-runs no-ops","Do not interrupt bd mid-migration; retry the whole pass instead","Keep the Dolt working set clean (no manual edits) before upgrading","Align Dolt server version with the binary's expectations"],"tags":["dolt","migration","commit","transient"],"backgroundTag":"dolt-commit-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}