gastownhall/beads · error
LoadCreateContext: read custom types: %w
Error message
LoadCreateContext: read custom types: %w
What it means
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.
Source
Thrown at internal/storage/domain/config.go:257
func (u *configUseCaseImpl) SetLocalMetadata(ctx context.Context, key, value string) error {
if err := u.cfgRepo.SetLocalMetadata(ctx, key, value); err != nil {
return fmt.Errorf("SetLocalMetadata: %w", err)
}
return nil
}
func (u *configUseCaseImpl) LoadCreateContext(ctx context.Context) (CreateContext, error) {
prefix, err := u.cfgRepo.GetConfig(ctx, "issue_prefix")
if err != nil {
return CreateContext{}, fmt.Errorf("LoadCreateContext: read issue_prefix: %w", err)
}
allowed, err := u.cfgRepo.GetAllowedPrefixes(ctx)
if err != nil {
return CreateContext{}, fmt.Errorf("LoadCreateContext: read allowed_prefixes: %w", err)
}
customTypes, err := u.cfgRepo.GetCustomTypes(ctx)
if err != nil {
return CreateContext{}, fmt.Errorf("LoadCreateContext: read custom types: %w", err)
}
customStatuses, err := u.cfgRepo.GetCustomStatuses(ctx)
if err != nil {
return CreateContext{}, fmt.Errorf("LoadCreateContext: read custom statuses: %w", err)
}
infraTypes, err := u.GetInfraTypes(ctx)
if err != nil {
return CreateContext{}, fmt.Errorf("LoadCreateContext: read infra types: %w", err)
}
return CreateContext{
IssuePrefix: prefix,
AllowedPrefixes: allowed,
CustomTypes: customTypes,
CustomStatuses: customStatuses,
InfraTypes: infraTypes,
}, nil
}
View on GitHub (pinned to 71377f2769)
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
Defensive patterns
Strategy: retry
Validate before calling
// verify custom types are readable before create flows
if _, err := store.GetCustomTypes(ctx); err != nil {
return fmt.Errorf("custom types unreadable, check migrations: %w", err)
} Try / catch
cc, err := uc.LoadCreateContext(ctx)
if err != nil && strings.Contains(err.Error(), "read custom types") {
if isSchemaMismatch(errors.Unwrap(err)) {
runMigrations() // align DB schema with bd version
cc, err = uc.LoadCreateContext(ctx)
}
}
return err Prevention
- 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
When it happens
Trigger: Calling LoadCreateContext when GetCustomTypes fails — query error on the custom-types store, DB connection failure, cancelled/expired context.
Common situations: 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.
Related errors
- LoadCreateContext: read issue_prefix: %w
- LoadCreateContext: read allowed_prefixes: %w
- LoadCreateContext: read custom statuses: %w
- LoadCreateContext: read infra types: %w
- not found
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/7ad9bfd7578cbffa.
Report an issue: GitHub.