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 mirror

View on GitHub (pinned to 71377f2769)

Solutions

  1. Check database/driver connectivity and retry.
  2. Ensure the config table exists and is populated (run bd init / bd doctor).
  3. Verify no schema drift between bd version and DB; migrate if needed.
  4. 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

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


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/08f9b8ac5c98f438. Report an issue: GitHub.