gastownhall/beads · error
failed to import memory %q: %w
Error message
failed to import memory %q: %w
What it means
While importing memory records, store.SetConfig failed to persist a key/value pair under the internal kv prefix, so import aborts with the memory's key in the message. The wrapped error explains why the config write failed (store, transaction, or storage-level issue).
Source
Thrown at cmd/bd/import.go:334
}
if importDryRun {
result.Memories = len(memories)
result.Skipped = dedupHits
classification, err := classifyDryRunImport(ctx, store, issues, importAllowStale)
if err != nil {
return fmt.Errorf("dry-run: %w", err)
}
applyImportDryRunClassification(&result, classification)
return renderImportDryRun(result, len(memories), source, dedupHits)
}
// Import memories
for _, mem := range memories {
storageKey := kvPrefix + memoryPrefix + mem.Key
if err := store.SetConfig(ctx, storageKey, mem.Value); err != nil {
return fmt.Errorf("failed to import memory %q: %w", mem.Key, err)
}
result.Memories++
}
// Import issues
if len(issues) > 0 {
opts := ImportOptions{SkipPrefixValidation: true, AllowStale: importAllowStale}
importResult, err := importIssuesCore(ctx, "", store, issues, opts)
if err != nil {
return fmt.Errorf("import failed: %w", err)
}
applyImportOutcome(&result, importResult)
}
if result.Created > 0 || result.Memories > 0 {
commitMsg := fmt.Sprintf("bd import: %d issues", result.Created)
if result.Memories > 0 {
commitMsg += fmt.Sprintf(", %d memories", result.Memories)View on GitHub (pinned to 71377f2769)
Solutions
- Read the wrapped error after `failed to import memory` for the storage cause
- Ensure no other bd process holds the DB (close other sessions, check locks)
- Verify the database file and its directory are writable
- Run `bd doctor` to diagnose storage health, then re-run the import
Example fix
// before $ bd import mem.jsonl failed to import memory "team": database is locked // after $ bd doctor # resolve lock / permissions $ bd import mem.jsonl
Defensive patterns
Strategy: retry
Validate before calling
bd doctor # verify storage writable and unlocked [ -w .beads/ ] && echo writable
Try / catch
for i in 1 2 3; do bd import data.jsonl && break sleep $((i*i)) # back off if 'database is locked' done
Prevention
- Avoid concurrent bd sessions against the same database during import
- Mount the repo and .beads directory read-write
- Monitor disk space on the volume holding the database
- Run bd doctor when storage errors recur
When it happens
Trigger: `bd import` with memory records where store.SetConfig errors — database locked by another process, read-only filesystem/database, store closed mid-import, or storage driver failure.
Common situations: Two bd processes (or an agent plus a shell) writing simultaneously; running import on a read-only checkout or read-only DB file; disk-full conditions.
Related errors
- resolving ID %s: %w
- failed to check parent issue: %w
- canonical issue not found: %s
- failed to add supersede link: %w
- batch create: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/3d35e53c05af70fd.
Report an issue: GitHub.