gastownhall/beads · error
db: GetAllowedPrefixes: %w
Error message
db: GetAllowedPrefixes: %w
What it means
This error wraps a driver-level failure from GetConfig(ctx, "allowed_prefixes") when reading the allowed issue prefixes setting. It is thrown by GetAllowedPrefixes only when the SELECT on the config table itself fails; a missing key returns an empty string without error. The wrapper preserves the underlying cause via %w for errors.Is/As inspection.
Source
Thrown at internal/storage/domain/db/config.go:208
continue
}
if _, ok := seen[t]; ok {
continue
}
seen[t] = struct{}{}
out = append(out, t)
}
}
if len(out) == 0 {
return nil
}
return out
}
func (r *configSQLRepositoryImpl) GetAllowedPrefixes(ctx context.Context) (string, error) {
value, err := r.GetConfig(ctx, "allowed_prefixes")
if err != nil {
return "", fmt.Errorf("db: GetAllowedPrefixes: %w", err)
}
return value, nil
}
func (r *configSQLRepositoryImpl) GetAdaptiveIDConfig(ctx context.Context) (domain.AdaptiveIDConfig, error) {
cfg := domain.DefaultAdaptiveConfig()
if probStr, err := r.GetConfig(ctx, "max_collision_prob"); err != nil {
return cfg, fmt.Errorf("db: GetAdaptiveIDConfig: read max_collision_prob: %w", err)
} else if probStr != "" {
if prob, perr := strconv.ParseFloat(probStr, 64); perr == nil {
cfg.MaxCollisionProbability = prob
}
}
if minStr, err := r.GetConfig(ctx, "min_hash_length"); err != nil {
return cfg, fmt.Errorf("db: GetAdaptiveIDConfig: read min_hash_length: %w", err)
} else if minStr != "" {View on GitHub (pinned to 71377f2769)
Solutions
- Unwrap with errors.Is/errors.As to classify the driver error.
- Restore database connectivity and retry the read.
- If deadline-driven, increase the caller's context timeout.
- Confirm the config table is present and queryable on the server.
Defensive patterns
Strategy: try-catch
Validate before calling
if err := conn.PingContext(ctx); err != nil {
return fmt.Errorf("cannot read allowed_prefixes: database unreachable: %w", err)
} Try / catch
prefixes, err := store.GetAllowedPrefixes(ctx)
if err != nil {
if errors.Is(err, context.DeadlineExceeded) {
return retry(ctx)
}
return fmt.Errorf("GetAllowedPrefixes failed: %w", err)
} Prevention
- Validate connectivity before config reads at startup.
- Set generous but bounded context timeouts.
- Use errors.Is/errors.As on the wrapped cause to route retry vs fail.
When it happens
Trigger: Calling GetAllowedPrefixes when the connection to the database is broken, the context is cancelled, or the server returns an error for the `SELECT value FROM config WHERE key = 'allowed_prefixes'` query.
Common situations: Remote Dolt server unreachable, connection pool timeouts, query cancelled by an expiring request deadline, or server-side errors on the config table.
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: GetInfraTypes: %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/93d255526ba826fd.
Report an issue: GitHub.