gastownhall/beads · error
db: GetAdaptiveIDConfig: read max_collision_prob: %w
Error message
db: GetAdaptiveIDConfig: read max_collision_prob: %w
What it means
This error wraps a GetConfig(ctx, "max_collision_prob") failure while assembling the AdaptiveIDConfig in GetAdaptiveIDConfig. It fires only on driver/connection errors — an unset key returns empty string and the default MaxCollisionProbability is kept. The setting value itself is never the cause; parse failures are silently ignored by design.
Source
Thrown at internal/storage/domain/db/config.go:217
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 != "" {
if v, perr := strconv.Atoi(minStr); perr == nil {
cfg.MinLength = v
}
}
if maxStr, err := r.GetConfig(ctx, "max_hash_length"); err != nil {
return cfg, fmt.Errorf("db: GetAdaptiveIDConfig: read max_hash_length: %w", err)
} else if maxStr != "" {
if v, perr := strconv.Atoi(maxStr); perr == nil {View on GitHub (pinned to 71377f2769)
Solutions
- Unwrap the error to identify the underlying driver failure.
- Retry once the connection is restored; startup-time callers can re-attempt initialization.
- Raise context timeouts if the read is being cancelled.
- Run a manual `SELECT value FROM config WHERE key='max_collision_prob'` to confirm server health.
Defensive patterns
Strategy: try-catch
Try / catch
cfg, err := store.GetAdaptiveIDConfig(ctx)
if err != nil {
if strings.Contains(err.Error(), "max_collision_prob") || errors.Is(err, context.Canceled) {
return domain.DefaultAdaptiveConfig(), nil // safe fallback to defaults
}
return fmt.Errorf("adaptive config load failed: %w", err)
} Prevention
- Fall back to domain.DefaultAdaptiveConfig() on transient failures rather than aborting.
- Batch config reads early in startup while the connection is fresh.
- Use errors.Is to distinguish cancellation from hard failures.
When it happens
Trigger: Calling GetAdaptiveIDConfig when the SELECT on the config table for max_collision_prob fails (broken connection, cancelled context, server error).
Common situations: Database connectivity issues during startup/initialization of the adaptive ID subsystem; request contexts cancelled before the read completes; remote Dolt server restarts.
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: GetAdaptiveIDConfig: read min_hash_length: %w
- db: GetAdaptiveIDConfig: read max_hash_length: %w
- failed to load config: %w
- no database configuration found
- failed to import config %q: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/aa3d2e4d88944b6e.
Report an issue: GitHub.