{"record":{"id":"8cdbd8c640d4035d","repo":"gastownhall/beads","slug":"commit-import-w","errorCode":null,"errorMessage":"commit import: %w","messagePattern":"commit import: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/bootstrap.go","lineNumber":710,"sourceCode":"\tif err != nil {\n\t\treturn fmt.Errorf(\"create database: %w\", err)\n\t}\n\tdefer func() { _ = s.Close() }()\n\n\tif err := s.SetConfig(ctx, \"issue_prefix\", prefix); err != nil {\n\t\treturn fmt.Errorf(\"set issue prefix: %w\", err)\n\t}\n\tif err := s.CommitWithConfig(ctx, \"bd bootstrap: init\"); err != nil {\n\t\treturn fmt.Errorf(\"commit init: %w\", err)\n\t}\n\n\tcount, err := importFromLocalJSONL(ctx, s, plan.JSONLFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"import from JSONL: %w\", err)\n\t}\n\n\tif err := s.Commit(ctx, \"bd bootstrap: import from issues.jsonl\"); err != nil {\n\t\treturn fmt.Errorf(\"commit import: %w\", err)\n\t}\n\n\tfmt.Fprintf(os.Stderr, \"Imported %d issues from %s\\n\", count, plan.JSONLFile)\n\treturn nil\n}\n\nfunc executeSyncAction(ctx context.Context, plan BootstrapPlan, cfg *configfile.Config) error {\n\t// Ensure .beads directory exists — it may not in the \"fresh clone\"\n\t// bootstrap path where we detected remote data before .beads was\n\t// created. Deferred here to preserve --dry-run semantics. (GH#2792)\n\tif err := os.MkdirAll(plan.BeadsDir, 0o750); err != nil {\n\t\treturn fmt.Errorf(\"create beads directory: %w\", err)\n\t}\n\n\tdbName := cfg.GetDoltDatabase()\n\tif err := cloneFromRemote(ctx, plan.BeadsDir, plan.SyncRemote, dbName, cfg); err != nil {\n\t\treturn err\n\t}","sourceCodeStart":692,"sourceCodeEnd":728,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/bootstrap.go#L692-L728","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# Before bootstrap, check disk space and that no other bd process holds the DB:\ndf -h . | awk 'NR==2 { exit ($5+0 > 90) ? 1 : 0 }' || echo \"low disk space\"\npgrep -f 'bd ' && echo \"another bd process may be running\"","typeGuard":null,"tryCatchPattern":"if err := executeJSONLImportAction(ctx, plan); err != nil {\n    if strings.Contains(err.Error(), \"commit import:\") {\n        // import succeeded but commit failed; safe to re-run bootstrap\n        return retryBootstrap(plan, 2) // idempotent re-import\n    }\n    return err\n}","preventionTips":["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."],"tags":["bootstrap","storage","commit","dolt"],"backgroundTag":"storage-commit-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}