gastownhall/beads · error
db: GetInfraTypes: %w
Error message
db: GetInfraTypes: %w
What it means
This error wraps a GetConfig(ctx, "types.infra") driver failure when reading the infrastructure-types mapping in GetInfraTypes. It occurs only when the SELECT on the config table fails; an unset or empty value returns an empty map without error. Value formatting problems (bad comma-separated lists) do not produce this error.
Source
Thrown at internal/storage/domain/db/config.go:269
}
custom, err := r.GetCustomStatuses(ctx)
if err != nil {
return nil, err
}
out := make([]string, 0, len(builtins)+len(custom))
for _, s := range builtins {
out = append(out, string(s))
}
for _, c := range custom {
out = append(out, c.Name)
}
return out, nil
}
func (r *configSQLRepositoryImpl) GetInfraTypes(ctx context.Context) (map[string]bool, error) {
value, err := r.GetConfig(ctx, "types.infra")
if err != nil {
return nil, fmt.Errorf("db: GetInfraTypes: %w", err)
}
value = strings.TrimSpace(value)
if value == "" {
return map[string]bool{}, nil
}
parts := strings.Split(value, ",")
result := make(map[string]bool, len(parts))
for _, p := range parts {
p = strings.TrimSpace(p)
if p != "" {
result[p] = true
}
}
return result, nil
}
View on GitHub (pinned to 71377f2769)
Solutions
- Unwrap the wrapped cause with errors.Is/errors.As.
- Restore database connectivity and retry.
- If context cancellation is the cause, adjust timeouts upstream.
- Confirm the config table is readable on the server.
Defensive patterns
Strategy: try-catch
Validate before calling
if err := conn.PingContext(ctx); err != nil {
return fmt.Errorf("cannot read infra types: database unreachable: %w", err)
} Try / catch
infra, err := store.GetInfraTypes(ctx)
if err != nil {
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
return map[string]bool{}, nil // empty map is a safe default
}
return fmt.Errorf("GetInfraTypes: %w", err)
} Prevention
- Return an empty map on transient failure since an empty infra-type set is a valid degraded mode.
- Check connectivity before config reads during startup.
- Classify wrapped causes before choosing retry vs fail.
When it happens
Trigger: Calling GetInfraTypes when the database connection is broken, the context is cancelled, or the server returns an error for the types.infra config lookup.
Common situations: Remote Dolt connectivity outages, cancelled request contexts, server errors on the config table during application startup or type-validation flows.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- db: GetAllowedPrefixes: %w
- no database connection available (%s)
- failed to load config: %w
- no database configuration found
- dolt server connection failed: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/82bede11e3ccccf9.
Report an issue: GitHub.