gastownhall/beads · error
read issue_prefix: %w
Error message
read issue_prefix: %w
What it means
Wraps failure of cfgRepo.GetConfig(ctx, "issue_prefix") during resolveTopLevelPrefix, which is called when minting a new top-level issue ID without an explicit prefix override. The config store itself failed to answer, as opposed to the config being empty.
Source
Thrown at internal/storage/domain/issue.go:1571
}
return false, nil
}
return visit(fromID)
}
// resolveTopLevelPrefix picks the prefix for a freshly-minted top-level ID,
// mirroring the embedded path's precedence (issueops/create.go:88-96 and
// dolt/wisps.go wispPrefix). Reads issue_prefix from config once and trims
// the trailing hyphen so a config value of "bd-" yields "bd-<hash>" rather
// than "bd--<hash>".
func (u *issueUseCaseImpl) resolveTopLevelPrefix(ctx context.Context, issue *types.Issue, useWisp bool) (string, error) {
if issue.PrefixOverride != "" {
return issue.PrefixOverride, nil
}
configPrefix, err := u.cfgRepo.GetConfig(ctx, "issue_prefix")
if err != nil {
return "", fmt.Errorf("read issue_prefix: %w", err)
}
configPrefix = strings.TrimSuffix(configPrefix, "-")
if configPrefix == "" {
return "", fmt.Errorf("issue_prefix config is missing")
}
switch {
case issue.IDPrefix != "":
return configPrefix + "-" + issue.IDPrefix, nil
case useWisp:
return configPrefix + "-wisp", nil
}
return configPrefix, nil
}
// mintTopLevelID generates a fresh top-level ID for an issue that has no
// ExplicitID and no ParentID. Honors counter mode for non-wisps (config key
// issue_id_mode=counter); otherwise uses adaptive hash-mode IDs that mirrorView on GitHub (pinned to 71377f2769)
Solutions
- Check database/driver connectivity and retry.
- Ensure the config table exists and is populated (run bd init / bd doctor).
- Verify no schema drift between bd version and DB; migrate if needed.
- Set issue.PrefixOverride to bypass config lookup if appropriate in your integration.
Defensive patterns
Strategy: fallback
Validate before calling
// check config readability before create
prefix, err := cfgRepo.GetConfig(ctx, "issue_prefix")
if err != nil {
return fmt.Errorf("config store unavailable: %w; set PrefixOverride to bypass", err)
} Try / catch
if err != nil {
if issue.PrefixOverride == "" {
return fmt.Errorf("cannot read issue_prefix and no override set: %w", err)
}
// fall back to override path
} Prevention
- Always run bd init on new workspaces.
- Set issue.PrefixOverride in embedded integrations to avoid config dependency.
- Monitor DB health before batch create operations.
- Keep bd and DB schema versions aligned.
When it happens
Trigger: Creating an issue (no ExplicitID, no ParentID, no PrefixOverride) while the config repository read errors: DB unreachable, config table missing/corrupt, context canceled.
Common situations: Fresh clone with uninitialized config table; dolt server down; schema mismatch after upgrading bd.
Related errors
- read issue_id_mode: %w
- read adaptive id config: %w
- failed to set routing.contributor: %w
- failed to set sync branch: %w
- failed to enable team mode: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/08f9b8ac5c98f438.
Report an issue: GitHub.