gastownhall/beads · error

issue_prefix config is missing

Error message

issue_prefix config is missing

What it means

issue_prefix is readable but empty (or only a trailing hyphen) after TrimSuffix, so bd cannot mint a new top-level ID. Unlike [3162], the config store answered successfully — the value is just unset.

Source

Thrown at internal/storage/domain/issue.go:1575

}

// 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
// issueops.GenerateIssueIDInTable. Reads issue.CreatedAt (caller must have
// stabilized it before this call so retries hash the same value).
func (u *issueUseCaseImpl) mintTopLevelID(ctx context.Context, issue *types.Issue, actor string, useWisp bool) (string, error) {
	prefix, err := u.resolveTopLevelPrefix(ctx, issue, useWisp)

View on GitHub (pinned to 71377f2769)

Solutions

  1. Set the config: bd config set issue_prefix <your-prefix> (e.g. "bd").
  2. Re-run bd init on the workspace to restore defaults.
  3. Pass an explicit PrefixOverride / explicit ID in the create call if you control the caller.
  4. Inspect config storage directly (dolt sql -q "select * from config where key='issue_prefix'").

Example fix

// before: config missing
bd create "Fix bug"   // errors

// after
bd config set issue_prefix bd
bd create "Fix bug"
Defensive patterns

Strategy: validation

Validate before calling

prefix, _ := cfgRepo.GetConfig(ctx, "issue_prefix")
prefix = strings.TrimSuffix(prefix, "-")
if prefix == "" {
    return errors.New("issue_prefix is not configured; run: bd config set issue_prefix bd")
}

Try / catch

if err != nil {
    if strings.Contains(err.Error(), "issue_prefix config is missing") {
        return fmt.Errorf("workspace not initialized; run bd init or set issue_prefix: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Creating a top-level issue without ExplicitID/ParentID/PrefixOverride while the issue_prefix config key is unset, empty string, or exactly "-".

Common situations: Manually edited config deleting the key; partial init that skipped prefix setup; fresh database created outside normal bd init.

Related errors


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