gastownhall/beads · error
commit import: %w
Error message
commit import: %w
What it means
During `bd bootstrap`, after importing issues from a local issues.jsonl into the store, the store commit (`s.Commit`) is issued with a fixed message. If the commit fails, the error is wrapped as `commit import: ...` and the bootstrap JSONL import action aborts. The import itself succeeded but the changes were not committed to the local Dolt database.
Source
Thrown at cmd/bd/bootstrap.go:710
if err != nil {
return fmt.Errorf("create database: %w", err)
}
defer func() { _ = s.Close() }()
if err := s.SetConfig(ctx, "issue_prefix", prefix); err != nil {
return fmt.Errorf("set issue prefix: %w", err)
}
if err := s.CommitWithConfig(ctx, "bd bootstrap: init"); err != nil {
return fmt.Errorf("commit init: %w", err)
}
count, err := importFromLocalJSONL(ctx, s, plan.JSONLFile)
if err != nil {
return fmt.Errorf("import from JSONL: %w", err)
}
if err := s.Commit(ctx, "bd bootstrap: import from issues.jsonl"); err != nil {
return fmt.Errorf("commit import: %w", err)
}
fmt.Fprintf(os.Stderr, "Imported %d issues from %s\n", count, plan.JSONLFile)
return nil
}
func executeSyncAction(ctx context.Context, plan BootstrapPlan, cfg *configfile.Config) error {
// Ensure .beads directory exists — it may not in the "fresh clone"
// bootstrap path where we detected remote data before .beads was
// created. Deferred here to preserve --dry-run semantics. (GH#2792)
if err := os.MkdirAll(plan.BeadsDir, 0o750); err != nil {
return fmt.Errorf("create beads directory: %w", err)
}
dbName := cfg.GetDoltDatabase()
if err := cloneFromRemote(ctx, plan.BeadsDir, plan.SyncRemote, dbName, cfg); err != nil {
return err
}View on GitHub (pinned to 71377f2769)
Solutions
- Read the wrapped cause: free disk space if it reports I/O errors, or retry bootstrap after other bd processes exit if it reports a lock.
- Re-run `bd bootstrap` — the import is re-executed and committed fresh.
- If the local DB is corrupted, check `bd doctor` or remove the local DB and re-clone from remote via bootstrap.
- Check the .beads directory permissions are writable.
Defensive patterns
Strategy: retry
Validate before calling
# Before bootstrap, check disk space and that no other bd process holds the DB:
df -h . | awk 'NR==2 { exit ($5+0 > 90) ? 1 : 0 }' || echo "low disk space"
pgrep -f 'bd ' && echo "another bd process may be running" Try / catch
if err := executeJSONLImportAction(ctx, plan); err != nil {
if strings.Contains(err.Error(), "commit import:") {
// import succeeded but commit failed; safe to re-run bootstrap
return retryBootstrap(plan, 2) // idempotent re-import
}
return err
} Prevention
- Ensure adequate disk space and writable `.beads` before bootstrapping.
- Avoid running concurrent bd commands against the same repo during bootstrap.
- If bootstrap fails mid-way, simply re-run it — import+commit is repeatable.
- Monitor wrapped causes (%w) for lock vs. I/O vs. corruption to pick the right remedy.
When it happens
Trigger: `bd bootstrap` executes a JSONL import action (`executeBootstrapPlan`); `importFromLocalJSONL` succeeds but `s.Commit(ctx, ...)` fails — e.g. storage engine errors, disk full, database lock, or corrupted local Dolt DB.
Common situations: Disk-full during bootstrap on a fresh clone; another bd process holding the database; interrupted prior bootstrap leaving the DB in a locked/bad state.
Related errors
- failed to commit pending changes before pull: %w
- ErrExec
- database %q not found on Dolt server at %s:%d
- database not available: %w
- not using Dolt backend (configured backend %q)
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/8cdbd8c640d4035d.
Report an issue: GitHub.