{"record":{"id":"3d9d694b2c6b1bca","repo":"gastownhall/beads","slug":"issue-prefix-config-is-missing","errorCode":null,"errorMessage":"issue_prefix config is missing","messagePattern":"issue_prefix config is missing","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/issue.go","lineNumber":1575,"sourceCode":"}\n\n// resolveTopLevelPrefix picks the prefix for a freshly-minted top-level ID,\n// mirroring the embedded path's precedence (issueops/create.go:88-96 and\n// dolt/wisps.go wispPrefix). Reads issue_prefix from config once and trims\n// the trailing hyphen so a config value of \"bd-\" yields \"bd-<hash>\" rather\n// than \"bd--<hash>\".\nfunc (u *issueUseCaseImpl) resolveTopLevelPrefix(ctx context.Context, issue *types.Issue, useWisp bool) (string, error) {\n\tif issue.PrefixOverride != \"\" {\n\t\treturn issue.PrefixOverride, nil\n\t}\n\n\tconfigPrefix, err := u.cfgRepo.GetConfig(ctx, \"issue_prefix\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"read issue_prefix: %w\", err)\n\t}\n\tconfigPrefix = strings.TrimSuffix(configPrefix, \"-\")\n\tif configPrefix == \"\" {\n\t\treturn \"\", fmt.Errorf(\"issue_prefix config is missing\")\n\t}\n\n\tswitch {\n\tcase issue.IDPrefix != \"\":\n\t\treturn configPrefix + \"-\" + issue.IDPrefix, nil\n\tcase useWisp:\n\t\treturn configPrefix + \"-wisp\", nil\n\t}\n\treturn configPrefix, nil\n}\n\n// mintTopLevelID generates a fresh top-level ID for an issue that has no\n// ExplicitID and no ParentID. Honors counter mode for non-wisps (config key\n// issue_id_mode=counter); otherwise uses adaptive hash-mode IDs that mirror\n// issueops.GenerateIssueIDInTable. Reads issue.CreatedAt (caller must have\n// stabilized it before this call so retries hash the same value).\nfunc (u *issueUseCaseImpl) mintTopLevelID(ctx context.Context, issue *types.Issue, actor string, useWisp bool) (string, error) {\n\tprefix, err := u.resolveTopLevelPrefix(ctx, issue, useWisp)","sourceCodeStart":1557,"sourceCodeEnd":1593,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/issue.go#L1557-L1593","documentation":"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.","triggerScenarios":"Creating a top-level issue without ExplicitID/ParentID/PrefixOverride while the issue_prefix config key is unset, empty string, or exactly \"-\".","commonSituations":"Manually edited config deleting the key; partial init that skipped prefix setup; fresh database created outside normal bd init.","solutions":["Set the config: bd config set issue_prefix <your-prefix> (e.g. \"bd\").","Re-run bd init on the workspace to restore defaults.","Pass an explicit PrefixOverride / explicit ID in the create call if you control the caller.","Inspect config storage directly (dolt sql -q \"select * from config where key='issue_prefix'\")."],"exampleFix":"// before: config missing\nbd create \"Fix bug\"   // errors\n\n// after\nbd config set issue_prefix bd\nbd create \"Fix bug\"","handlingStrategy":"validation","validationCode":"prefix, _ := cfgRepo.GetConfig(ctx, \"issue_prefix\")\nprefix = strings.TrimSuffix(prefix, \"-\")\nif prefix == \"\" {\n    return errors.New(\"issue_prefix is not configured; run: bd config set issue_prefix bd\")\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if strings.Contains(err.Error(), \"issue_prefix config is missing\") {\n        return fmt.Errorf(\"workspace not initialized; run bd init or set issue_prefix: %w\", err)\n    }\n    return err\n}","preventionTips":["Run bd init before first use in any workspace.","Never hand-delete config keys; use bd config commands.","Assert issue_prefix is set in CI setup steps.","Document the required prefix in team onboarding."],"tags":["config","id-generation","setup"],"backgroundTag":"missing-config-value","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}