gastownhall/beads · error
failed to import config %q: %w
Error message
failed to import config %q: %w
What it means
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.
Source
Thrown at cmd/bd/import_shared.go:1153
return importFromLocalJSONLWithOpts(ctx, store, localPath, true)
}
// importFromLocalJSONLWithOpts is the shared implementation. It detects
// memory records (lines with "_type":"memory") and imports them via
// SetConfig, while routing regular issue records through the normal path.
// conflictSkip selects insert-if-new (true) vs UPSERT (false) for issue rows.
func importFromLocalJSONLWithOpts(ctx context.Context, store storage.DoltStorage, localPath string, conflictSkip bool) (*importLocalResult, error) {
issues, configEntries, err := parseJSONLFile(localPath)
if err != nil {
return nil, err
}
result := &importLocalResult{}
// Import memories
for key, value := range configEntries {
if err := store.SetConfig(ctx, key, value); err != nil {
return nil, fmt.Errorf("failed to import config %q: %w", key, err)
}
result.Memories++
}
// Import issues
if len(issues) > 0 {
// Auto-detect prefix from first issue if not already configured
configuredPrefix, err := store.GetConfig(ctx, "issue_prefix")
if err == nil && strings.TrimSpace(configuredPrefix) == "" {
firstPrefix := utils.ExtractIssuePrefix(issues[0].ID)
if firstPrefix != "" {
if err := store.SetConfig(ctx, "issue_prefix", firstPrefix); err != nil {
return nil, fmt.Errorf("failed to set issue_prefix from imported issues: %w", err)
}
}
}
opts := ImportOptions{View on GitHub (pinned to 71377f2769)
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
Example fix
// before: importing memories into a read-only gateway DB bd bootstrap # fails: failed to import config "beads:memory:xyz": ... // after: use credentials/endpoint with write access, or set the config explicitly bd config set beads:memory:xyz "value"
Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure the store is reachable and writable before importing
if err := store.SetConfig(ctx, "_import_probe", "1"); err != nil {
return fmt.Errorf("store not writable: %w", err)
}
_ = store.SetConfig(ctx, "_import_probe", "") Try / catch
if err := store.SetConfig(ctx, key, value); err != nil {
log.Printf("config %q not imported: %v", key, err)
// check cause: locked DB, permission denied, or connection refused
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- failed to set issue_prefix from imported issues: %w
- failed to load config: %w
- db: SetConfig %s: %w
- ErrTransaction
- ErrQuery
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/386569968ea5ede6.
Report an issue: GitHub.