{"record":{"id":"569af92e278f5d99","repo":"gastownhall/beads","slug":"loadcreatecontext-read-issue-prefix-w","errorCode":null,"errorMessage":"LoadCreateContext: read issue_prefix: %w","messagePattern":"LoadCreateContext: read issue_prefix: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/config.go","lineNumber":249,"sourceCode":"\nfunc (u *configUseCaseImpl) SetMetadata(ctx context.Context, key, value string) error {\n\tif err := u.cfgRepo.SetMetadata(ctx, key, value); err != nil {\n\t\treturn fmt.Errorf(\"SetMetadata: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc (u *configUseCaseImpl) SetLocalMetadata(ctx context.Context, key, value string) error {\n\tif err := u.cfgRepo.SetLocalMetadata(ctx, key, value); err != nil {\n\t\treturn fmt.Errorf(\"SetLocalMetadata: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc (u *configUseCaseImpl) LoadCreateContext(ctx context.Context) (CreateContext, error) {\n\tprefix, err := u.cfgRepo.GetConfig(ctx, \"issue_prefix\")\n\tif err != nil {\n\t\treturn CreateContext{}, fmt.Errorf(\"LoadCreateContext: read issue_prefix: %w\", err)\n\t}\n\tallowed, err := u.cfgRepo.GetAllowedPrefixes(ctx)\n\tif err != nil {\n\t\treturn CreateContext{}, fmt.Errorf(\"LoadCreateContext: read allowed_prefixes: %w\", err)\n\t}\n\tcustomTypes, err := u.cfgRepo.GetCustomTypes(ctx)\n\tif err != nil {\n\t\treturn CreateContext{}, fmt.Errorf(\"LoadCreateContext: read custom types: %w\", err)\n\t}\n\tcustomStatuses, err := u.cfgRepo.GetCustomStatuses(ctx)\n\tif err != nil {\n\t\treturn CreateContext{}, fmt.Errorf(\"LoadCreateContext: read custom statuses: %w\", err)\n\t}\n\tinfraTypes, err := u.GetInfraTypes(ctx)\n\tif err != nil {\n\t\treturn CreateContext{}, fmt.Errorf(\"LoadCreateContext: read infra types: %w\", err)\n\t}\n\treturn CreateContext{","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/config.go#L231-L267","documentation":"Wrapping error from ConfigUseCaseImpl.LoadCreateContext in internal/storage/domain/config.go:249. It fires when reading the 'issue_prefix' config value via cfgRepo.GetConfig fails. LoadCreateContext assembles everything needed to create issues (prefix, allowed prefixes, custom types/statuses, infra types); this is the first read in that sequence, so a storage failure aborts issue creation early.","triggerScenarios":"Calling LoadCreateContext when cfgRepo.GetConfig(ctx, \"issue_prefix\") returns a non-nil error — DB unavailable, query failure, cancelled context.","commonSituations":"First bd create command after the DB was moved or corrupted; database server down; stale connection pool after a network blip.","solutions":["Unwrap to see the storage-level cause","Confirm the database is reachable and the config table is readable","Verify 'issue_prefix' config storage isn't corrupted (run bd doctor / storage checks)","Retry LoadCreateContext once storage is healthy"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// confirm storage is healthy before loading create context\nif err := uc.Ping(ctx); err != nil {\n\treturn fmt.Errorf(\"cannot create issue: storage unreachable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"cc, err := uc.LoadCreateContext(ctx)\nif err != nil {\n\tif strings.Contains(err.Error(), \"read issue_prefix\") && errors.Is(err, context.DeadlineExceeded) {\n\t\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\t\tdefer cancel()\n\t\tcc, err = uc.LoadCreateContext(ctx)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n}","preventionTips":["Ping the database before issue-creation flows","Match on the 'read issue_prefix' message segment to identify this read","Use generous timeouts for cold-start reads","Run bd doctor when config reads start failing"],"tags":["config","storage","issue-prefix","error-wrapping"],"backgroundTag":"config-read-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}