gastownhall/beads · error

committing 0041 nonlocal repair: %w

Error message

committing 0041 nonlocal repair: %w

What it means

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.

Source

Thrown at internal/storage/schema/migration_repairs.go:156

// 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
	}
	if present {
		return nil
	}
	if _, err := db.ExecContext(ctx,
		"INSERT IGNORE INTO dolt_nonlocal_tables (table_name, target_ref, options) VALUES "+nonlocalFrozenRowsValues); err != nil {
		return fmt.Errorf("restoring pre-0041 nonlocal rows: %w", err)
	}
	if err := commitNonlocalRepair(ctx, db,
		"repair: restore pre-0041 nonlocal rows before replay"); err != nil {
		return fmt.Errorf("committing 0041 nonlocal repair: %w", err)
	}
	return nil
}

// ensureWispTablesForMixedBlockedRecompute repairs #4695 (and the identical
// #4176 clone-skew shape): migration 0047's final recompute block joins
// wisps/wisp_dependencies unconditionally in a WITH RECURSIVE UPDATE. Those
// tables are dolt_ignore'd (0019_wisps_dolt_ignore,
// 0040_ignored_tables_also_nonlocal_tables), so they never sync to a clone,
// and MigrateUp runs the main sequence (which reaches 0047) before the
// ignored sequence that (re)creates them locally. Any clone whose
// schema_migrations cursor arrives below the binary's latest -- the normal
// window right after a schema bump, before every producer has re-pushed, and
// also how a pre-1.0 database's stale cursor numbering can treat the main
// 0020/0021 wisp-creating migrations as already applied -- reaches 0047 with
// the wisp tables altogether missing: "Error 1146: table not found: wisps".
//
// 0047's own SQL is frozen (already shipped, content-hashed); create the

View on GitHub (pinned to 71377f2769)

Solutions

  1. Retry bd init — the presence guard makes re-runs clean no-ops once committed
  2. Resolve dirty/conflicted Dolt working-set state before retrying
  3. Confirm the Dolt sql-server is reachable and healthy
  4. Inspect the wrapped underlying error for the exact commit failure
Defensive patterns

Strategy: retry

Try / catch

if err := commitNonlocalRepair(ctx, db, "repair: restore pre-0041 nonlocal rows before replay"); err != nil {
    if isTransient(err) {
        return retryRepair(ctx, db) // presence guard makes re-run a no-op once committed
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: Network flake during bd init; leftover dirty working set from a crashed prior repair; Dolt server incompatibility.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/1e890990f7aba941. Report an issue: GitHub.