gastownhall/beads · error
failed to set issue_prefix from imported issues: %w
Error message
failed to set issue_prefix from imported issues: %w
What it means
After importing issues, if no issue_prefix is configured, importFromLocalJSONLWithOpts auto-detects it from the first imported issue's ID (utils.ExtractIssuePrefix) and writes it via store.SetConfig. This error wraps a failure of that SetConfig write — the issues imported, but the prefix could not be recorded.
Source
Thrown at cmd/bd/import_shared.go:1166
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{
SkipPrefixValidation: true,
ConflictSkip: conflictSkip,
}
importResult, err := importIssuesCore(ctx, "", store, issues, opts)
if err != nil {
return nil, err
}
result.Issues = importResult.Created
}
return result, nil
}
View on GitHub (pinned to 71377f2769)
Solutions
- Read the wrapped %w cause for the underlying DB error
- Set the prefix manually once the DB is writable: `bd config set issue_prefix <prefix>`
- Check gateway credentials/permissions if using a hosted database
- Ensure the Dolt server is running and the data dir has free space, then re-run
Example fix
// before: auto-detect write fails on read-only gateway // after: provisioned prefix should already exist server-side; verify with bd config get issue_prefix # if empty, re-provision server-side or use writable credentials
Defensive patterns
Strategy: try-catch
Validate before calling
prefix, err := store.GetConfig(ctx, "issue_prefix")
if err != nil { return err }
if strings.TrimSpace(prefix) == "" {
// prefix will be auto-set from issues[0]; ensure the store is writable first
if err := store.SetConfig(ctx, "issue_prefix", "_probe"); err != nil { return err }
} Try / catch
if err := store.SetConfig(ctx, "issue_prefix", firstPrefix); err != nil {
log.Printf("could not persist auto-detected prefix %q: %v", firstPrefix, err)
return err
} Prevention
- Provision issue_prefix server-side before gateway imports so auto-detect never runs
- Check writability of the store before importing a JSONL with issues
- Keep the Dolt server healthy and the disk non-full
- Prefer running imports from a rig with write credentials
When it happens
Trigger: JSONL import where issues[0].ID has a detectable prefix (e.g. "bd-1"), store.GetConfig("issue_prefix") returned empty, and the subsequent SetConfig("issue_prefix", prefix) fails against the Dolt store (DB error, read-only gateway, locked DB).
Common situations: Same DB-level problems as config import: read-only hosted credentials, Dolt server down, disk full; importing into a database provisioned without a prefix (which in gateway mode is normally rejected earlier).
Related errors
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/330125428c281218.
Report an issue: GitHub.