{"record":{"id":"22e6af122f0cbf6a","repo":"gastownhall/beads","slug":"read-adaptive-id-config-w","errorCode":null,"errorMessage":"read adaptive id config: %w","messagePattern":"read adaptive id config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/issue.go","lineNumber":1617,"sourceCode":"\t// because there is no wisp_counter table and ephemeral churn would make\n\t// a monotonic counter meaningless.\n\tif !useWisp {\n\t\tmode, err := u.cfgRepo.GetConfig(ctx, \"issue_id_mode\")\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"read issue_id_mode: %w\", err)\n\t\t}\n\t\tif mode == \"counter\" {\n\t\t\tn, err := u.issueRepo.NextCounterID(ctx, prefix)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\treturn fmt.Sprintf(\"%s-%d\", prefix, n), nil\n\t\t}\n\t}\n\n\tcfg, err := u.cfgRepo.GetAdaptiveIDConfig(ctx)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"read adaptive id config: %w\", err)\n\t}\n\ttableOpts := IssueTableOpts{UseWispsTable: useWisp}\n\n\tcount, err := u.issueRepo.CountForPrefix(ctx, prefix, tableOpts)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tbaseLength := ComputeAdaptiveLength(count, cfg)\n\tif baseLength > cfg.MaxLength {\n\t\tbaseLength = cfg.MaxLength\n\t}\n\n\tfor length := baseLength; length <= cfg.MaxLength; length++ {\n\t\tfor nonce := 0; nonce < 10; nonce++ {\n\t\t\tcandidate := idgen.GenerateHashID(prefix, issue.Title, issue.Description, actor, issue.CreatedAt, length, nonce)\n\t\t\texists, err := u.issueRepo.Exists(ctx, candidate, tableOpts)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err","sourceCodeStart":1599,"sourceCodeEnd":1635,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/issue.go#L1599-L1635","documentation":"Wraps failure of cfgRepo.GetAdaptiveIDConfig during mintTopLevelID's hash-ID path. This config supplies min/max adaptive hash-length parameters; without it bd cannot size candidate IDs.","triggerScenarios":"Minting a hash-mode ID (wisp, or regular issue when issue_id_mode != counter) while GetAdaptiveIDConfig errors: config keys absent, storage failure, canceled context.","commonSituations":"Workspace initialized by an older bd that predates adaptive-ID config keys; manually pruned config table; DB outage mid-create.","solutions":["Re-run bd init / migration to populate adaptive-ID config defaults.","Verify config keys for adaptive ID exist in the config table via dolt sql.","Check DB/driver connectivity and retry.","Upgrade/downgrade alignment: ensure bd version matches DB schema version."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"cfg, err := cfgRepo.GetAdaptiveIDConfig(ctx)\nif err != nil || cfg.MaxLength == 0 {\n    cfg = DefaultAdaptiveIDConfig() // sane fallback\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if errors.Is(err, ErrConfigNotFound) {\n        cfg = DefaultAdaptiveIDConfig() // fall back to defaults\n    } else {\n        return fmt.Errorf(\"adaptive id config unreadable: %w\", err)\n    }\n}","preventionTips":["Run bd init/migrations after upgrading so adaptive-ID keys exist.","Never prune unknown rows from the config table.","Pin bd binary version to the DB schema version.","Validate config completeness in CI (bd doctor)."],"tags":["config","id-generation","storage"],"backgroundTag":"missing-config-value","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}