gastownhall/beads · error
committing 0040 nonlocal repair: %w
Error message
committing 0040 nonlocal repair: %w
What it means
After clearing the partial 0040 rows, the repair commits the removal via commitNonlocalRepair (DOLT_ADD + DOLT_COMMIT --skip-empty). This error wraps failure of that commit step — the staged change could not be committed, usually from a connection drop or Dolt commit-procedure failure.
Source
Thrown at internal/storage/schema/migration_repairs.go:128
// [wisps]", bricking the database. 0040 is a shipped, content-hashed migration
// and cannot be edited (see the file header), so instead clear any of those four
// rows before the replay and commit the removal, leaving 0040's INSERT+COMMIT
// pairs a clean, real diff. No-op when 0040 never partially applied.
func repairPartial0040NonlocalInsert(ctx context.Context, db DBConn) error {
present, err := anyNonlocalFrozenRowPresent(ctx, db)
if err != nil {
return err
}
if !present {
return nil
}
if _, err := db.ExecContext(ctx,
"DELETE FROM dolt_nonlocal_tables WHERE table_name IN "+nonlocalFrozenRowsInList); err != nil {
return fmt.Errorf("clearing partial 0040 nonlocal rows: %w", err)
}
if err := commitNonlocalRepair(ctx, db,
"repair: clear partial 0040 nonlocal rows before replay"); err != nil {
return fmt.Errorf("committing 0040 nonlocal repair: %w", err)
}
return nil
}
// repairPartial0041NonlocalDelete heals a partially-applied migration 0041 so
// its shipped body can replay. 0041 begins by clearing dolt_nonlocal_tables and
// committing ("disable nonlocal tables for fk migrations"). If a transient
// interrupts 0041 after that commit but before its version row records, the
// retry re-runs 0041 against an already-empty table: the DELETE stages nothing
// and the paired DOLT_COMMIT (no --skip-empty in the shipped bytes) fails with
// "nothing to commit". Restore the pre-0041 invariant — the four rows 0040
// leaves — so the frozen DELETE+COMMIT has a real diff again. No-op when those
// rows are already present (the common path).
func repairPartial0041NonlocalDelete(ctx context.Context, db DBConn) error {
present, err := anyNonlocalFrozenRowPresent(ctx, db)
if err != nil {
return err
}View on GitHub (pinned to 71377f2769)
Solutions
- Retry bd init — the row-presence guard makes the repair safely re-runnable
- Resolve any dirty/conflicted Dolt working-set state before retrying
- Verify the Dolt server is healthy and reachable
- Inspect the wrapped underlying error for the specific commit failure
Defensive patterns
Strategy: retry
Try / catch
if err := commitNonlocalRepair(ctx, db, "repair: clear partial 0040 nonlocal rows before replay"); err != nil {
if isTransient(err) {
return retryRepair(ctx, db) // presence guard makes retry safe
}
return err
} Prevention
- Retry on transient commit failures; --skip-empty and the presence guard keep re-runs clean
- Resolve dirty/conflicted Dolt working-set state before upgrading
- Do not kill bd mid-migration; let the pass finish or retry it
- Keep Dolt server and client versions aligned
When it happens
Trigger: The DELETE succeeded but CALL DOLT_ADD/DOLT_COMMIT failed: connection interrupted mid-commit on a shared sql-server; dirty/conflicted Dolt working set; server-side procedure error.
Common situations: Network flake during bd init; working set left dirty by a previously crashed process; Dolt version incompatibility.
Related errors
- committing 0041 nonlocal repair: %w
- staging %s: %w
- clearing partial 0040 nonlocal rows: %w
- restoring pre-0041 nonlocal rows: %w
- checking wisps table: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/dfb3894b1e7be1e3.
Report an issue: GitHub.