{"record":{"id":"08f9b8ac5c98f438","repo":"gastownhall/beads","slug":"read-issue-prefix-w","errorCode":null,"errorMessage":"read issue_prefix: %w","messagePattern":"read issue_prefix: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/issue.go","lineNumber":1571,"sourceCode":"\t\t}\n\t\treturn false, nil\n\t}\n\treturn visit(fromID)\n}\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","sourceCodeStart":1553,"sourceCodeEnd":1589,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/issue.go#L1553-L1589","documentation":"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.","triggerScenarios":"Creating an issue (no ExplicitID, no ParentID, no PrefixOverride) while the config repository read errors: DB unreachable, config table missing/corrupt, context canceled.","commonSituations":"Fresh clone with uninitialized config table; dolt server down; schema mismatch after upgrading bd.","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."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// check config readability before create\nprefix, err := cfgRepo.GetConfig(ctx, \"issue_prefix\")\nif err != nil {\n    return fmt.Errorf(\"config store unavailable: %w; set PrefixOverride to bypass\", err)\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if issue.PrefixOverride == \"\" {\n        return fmt.Errorf(\"cannot read issue_prefix and no override set: %w\", err)\n    }\n    // fall back to override path\n}","preventionTips":["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."],"tags":["config","storage","id-generation"],"backgroundTag":"missing-config-value","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}