{"record":{"id":"7ad9bfd7578cbffa","repo":"gastownhall/beads","slug":"loadcreatecontext-read-custom-types-w","errorCode":null,"errorMessage":"LoadCreateContext: read custom types: %w","messagePattern":"LoadCreateContext: read custom types: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/config.go","lineNumber":257,"sourceCode":"func (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{\n\t\tIssuePrefix:     prefix,\n\t\tAllowedPrefixes: allowed,\n\t\tCustomTypes:     customTypes,\n\t\tCustomStatuses:  customStatuses,\n\t\tInfraTypes:      infraTypes,\n\t}, nil\n}\n","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/config.go#L239-L275","documentation":"Wrapping error from ConfigUseCaseImpl.LoadCreateContext at internal/storage/domain/config.go:257. Raised when cfgRepo.GetCustomTypes(ctx) fails. LoadCreateContext had already read issue_prefix and allowed prefixes; failure at this point means the custom issue-type configuration could not be loaded, blocking issue creation.","triggerScenarios":"Calling LoadCreateContext when GetCustomTypes fails — query error on the custom-types store, DB connection failure, cancelled/expired context.","commonSituations":"Custom types were added by a newer bd version and the storage schema/migration is out of date; corrupted custom-types rows; transient DB outage.","solutions":["Unwrap to find the underlying storage error","Check for pending schema migrations and apply them (bd version vs DB version mismatch)","Verify custom-types storage integrity","Retry after storage is healthy"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify custom types are readable before create flows\nif _, err := store.GetCustomTypes(ctx); err != nil {\n\treturn fmt.Errorf(\"custom types unreadable, check migrations: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"cc, err := uc.LoadCreateContext(ctx)\nif err != nil && strings.Contains(err.Error(), \"read custom types\") {\n\tif isSchemaMismatch(errors.Unwrap(err)) {\n\t\trunMigrations() // align DB schema with bd version\n\t\tcc, err = uc.LoadCreateContext(ctx)\n\t}\n}\nreturn err","preventionTips":["Run schema migrations after upgrading bd","Test GetCustomTypes directly to isolate the failing read","Avoid mixing bd client versions against one database","Retry transient DB errors with backoff"],"tags":["config","custom-types","storage","error-wrapping"],"backgroundTag":"config-read-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}