{"record":{"id":"93d255526ba826fd","repo":"gastownhall/beads","slug":"db-getallowedprefixes-w","errorCode":null,"errorMessage":"db: GetAllowedPrefixes: %w","messagePattern":"db: GetAllowedPrefixes: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/db/config.go","lineNumber":208,"sourceCode":"\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif _, ok := seen[t]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tseen[t] = struct{}{}\n\t\t\tout = append(out, t)\n\t\t}\n\t}\n\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 != \"\" {","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/db/config.go#L190-L226","documentation":"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.","triggerScenarios":"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.","commonSituations":"Remote Dolt server unreachable, connection pool timeouts, query cancelled by an expiring request deadline, or server-side errors on the config table.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if err := conn.PingContext(ctx); err != nil {\n    return fmt.Errorf(\"cannot read allowed_prefixes: database unreachable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"prefixes, err := store.GetAllowedPrefixes(ctx)\nif err != nil {\n    if errors.Is(err, context.DeadlineExceeded) {\n        return retry(ctx)\n    }\n    return fmt.Errorf(\"GetAllowedPrefixes failed: %w\", err)\n}","preventionTips":["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."],"tags":["database","config","connection"],"backgroundTag":"database-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}