{"record":{"id":"386569968ea5ede6","repo":"gastownhall/beads","slug":"failed-to-import-config-q-w","errorCode":null,"errorMessage":"failed to import config %q: %w","messagePattern":"failed to import config %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/import_shared.go","lineNumber":1153,"sourceCode":"\treturn importFromLocalJSONLWithOpts(ctx, store, localPath, true)\n}\n\n// importFromLocalJSONLWithOpts is the shared implementation. It detects\n// memory records (lines with \"_type\":\"memory\") and imports them via\n// SetConfig, while routing regular issue records through the normal path.\n// conflictSkip selects insert-if-new (true) vs UPSERT (false) for issue rows.\nfunc importFromLocalJSONLWithOpts(ctx context.Context, store storage.DoltStorage, localPath string, conflictSkip bool) (*importLocalResult, error) {\n\tissues, configEntries, err := parseJSONLFile(localPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := &importLocalResult{}\n\n\t// Import memories\n\tfor key, value := range configEntries {\n\t\tif err := store.SetConfig(ctx, key, value); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to import config %q: %w\", key, err)\n\t\t}\n\t\tresult.Memories++\n\t}\n\n\t// Import issues\n\tif len(issues) > 0 {\n\t\t// Auto-detect prefix from first issue if not already configured\n\t\tconfiguredPrefix, err := store.GetConfig(ctx, \"issue_prefix\")\n\t\tif err == nil && strings.TrimSpace(configuredPrefix) == \"\" {\n\t\t\tfirstPrefix := utils.ExtractIssuePrefix(issues[0].ID)\n\t\t\tif firstPrefix != \"\" {\n\t\t\t\tif err := store.SetConfig(ctx, \"issue_prefix\", firstPrefix); err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"failed to set issue_prefix from imported issues: %w\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\topts := ImportOptions{","sourceCodeStart":1135,"sourceCodeEnd":1171,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/import_shared.go#L1135-L1171","documentation":"importFromLocalJSONLWithOpts imports memory records found in the JSONL as config entries via store.SetConfig. If the Dolt-backed SetConfig write fails, the error is wrapped with the offending config key so you know which memory record could not be persisted.","triggerScenarios":"Running `bd bootstrap`, `bd init --from-jsonl`, or the auto-import fallback when a line with \"_type\":\"memory\" parsed fine but store.SetConfig(ctx, key, value) failed — typically a database-level failure: DB not open/locked, schema missing, permission denied, or gateway read-only credentials.","commonSituations":"Importing into a hosted/gateway database with read-only credentials; a Dolt server that is down or locked by another process; importing into a freshly created DB whose config table schema isn't initialized yet; disk full on the Dolt data directory.","solutions":["Read the inner %w error — it names the actual DB failure (locked, permission, connection)","Check DB connectivity/server: `bd doctor` or verify the Dolt server is running","If on gateway/hosted mode with read-only credentials, ensure writes are permitted or run from a rig with write access","Free disk space / clear DB locks, then retry the import"],"exampleFix":"// before: importing memories into a read-only gateway DB\nbd bootstrap  # fails: failed to import config \"beads:memory:xyz\": ...\n// after: use credentials/endpoint with write access, or set the config explicitly\nbd config set beads:memory:xyz \"value\"","handlingStrategy":"try-catch","validationCode":"// Ensure the store is reachable and writable before importing\nif err := store.SetConfig(ctx, \"_import_probe\", \"1\"); err != nil {\n    return fmt.Errorf(\"store not writable: %w\", err)\n}\n_ = store.SetConfig(ctx, \"_import_probe\", \"\")","typeGuard":null,"tryCatchPattern":"if err := store.SetConfig(ctx, key, value); err != nil {\n    log.Printf(\"config %q not imported: %v\", key, err)\n    // check cause: locked DB, permission denied, or connection refused\n    return err\n}","preventionTips":["Verify DB connectivity (`bd doctor`) before bulk imports","Use credentials with write access for gateway/hosted databases","Ensure the Dolt server is running and the data dir has free disk space","Avoid concurrent imports from multiple rigs against the same DB"],"tags":["database","config","import","dolt","write-failure"],"backgroundTag":"config-write-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}