{"record":{"id":"aa3d2e4d88944b6e","repo":"gastownhall/beads","slug":"db-getadaptiveidconfig-read-max-collision-prob","errorCode":null,"errorMessage":"db: GetAdaptiveIDConfig: read max_collision_prob: %w","messagePattern":"db: GetAdaptiveIDConfig: read max_collision_prob: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/db/config.go","lineNumber":217,"sourceCode":"\tif len(out) == 0 {\n\t\treturn nil\n\t}\n\treturn out\n}\n\nfunc (r *configSQLRepositoryImpl) GetAllowedPrefixes(ctx context.Context) (string, error) {\n\tvalue, err := r.GetConfig(ctx, \"allowed_prefixes\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"db: GetAllowedPrefixes: %w\", err)\n\t}\n\treturn value, nil\n}\n\nfunc (r *configSQLRepositoryImpl) GetAdaptiveIDConfig(ctx context.Context) (domain.AdaptiveIDConfig, error) {\n\tcfg := domain.DefaultAdaptiveConfig()\n\n\tif probStr, err := r.GetConfig(ctx, \"max_collision_prob\"); err != nil {\n\t\treturn cfg, fmt.Errorf(\"db: GetAdaptiveIDConfig: read max_collision_prob: %w\", err)\n\t} else if probStr != \"\" {\n\t\tif prob, perr := strconv.ParseFloat(probStr, 64); perr == nil {\n\t\t\tcfg.MaxCollisionProbability = prob\n\t\t}\n\t}\n\n\tif minStr, err := r.GetConfig(ctx, \"min_hash_length\"); err != nil {\n\t\treturn cfg, fmt.Errorf(\"db: GetAdaptiveIDConfig: read min_hash_length: %w\", err)\n\t} else if minStr != \"\" {\n\t\tif v, perr := strconv.Atoi(minStr); perr == nil {\n\t\t\tcfg.MinLength = v\n\t\t}\n\t}\n\n\tif maxStr, err := r.GetConfig(ctx, \"max_hash_length\"); err != nil {\n\t\treturn cfg, fmt.Errorf(\"db: GetAdaptiveIDConfig: read max_hash_length: %w\", err)\n\t} else if maxStr != \"\" {\n\t\tif v, perr := strconv.Atoi(maxStr); perr == nil {","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/db/config.go#L199-L235","documentation":"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.","triggerScenarios":"Calling GetAdaptiveIDConfig when the SELECT on the config table for max_collision_prob fails (broken connection, cancelled context, server error).","commonSituations":"Database connectivity issues during startup/initialization of the adaptive ID subsystem; request contexts cancelled before the read completes; remote Dolt server restarts.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"cfg, err := store.GetAdaptiveIDConfig(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"max_collision_prob\") || errors.Is(err, context.Canceled) {\n        return domain.DefaultAdaptiveConfig(), nil // safe fallback to defaults\n    }\n    return fmt.Errorf(\"adaptive config load failed: %w\", err)\n}","preventionTips":["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."],"tags":["database","config","adaptive-id"],"backgroundTag":"database-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}