{"record":{"id":"82bede11e3ccccf9","repo":"gastownhall/beads","slug":"db-getinfratypes-w","errorCode":null,"errorMessage":"db: GetInfraTypes: %w","messagePattern":"db: GetInfraTypes: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/db/config.go","lineNumber":269,"sourceCode":"\t}\n\tcustom, err := r.GetCustomStatuses(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tout := make([]string, 0, len(builtins)+len(custom))\n\tfor _, s := range builtins {\n\t\tout = append(out, string(s))\n\t}\n\tfor _, c := range custom {\n\t\tout = append(out, c.Name)\n\t}\n\treturn out, nil\n}\n\nfunc (r *configSQLRepositoryImpl) GetInfraTypes(ctx context.Context) (map[string]bool, error) {\n\tvalue, err := r.GetConfig(ctx, \"types.infra\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"db: GetInfraTypes: %w\", err)\n\t}\n\tvalue = strings.TrimSpace(value)\n\tif value == \"\" {\n\t\treturn map[string]bool{}, nil\n\t}\n\tparts := strings.Split(value, \",\")\n\tresult := make(map[string]bool, len(parts))\n\tfor _, p := range parts {\n\t\tp = strings.TrimSpace(p)\n\t\tif p != \"\" {\n\t\t\tresult[p] = true\n\t\t}\n\t}\n\treturn result, nil\n}\n","sourceCodeStart":251,"sourceCodeEnd":285,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/db/config.go#L251-L285","documentation":"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.","triggerScenarios":"Calling GetInfraTypes when the database connection is broken, the context is cancelled, or the server returns an error for the types.infra config lookup.","commonSituations":"Remote Dolt connectivity outages, cancelled request contexts, server errors on the config table during application startup or type-validation flows.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if err := conn.PingContext(ctx); err != nil {\n    return fmt.Errorf(\"cannot read infra types: database unreachable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"infra, err := store.GetInfraTypes(ctx)\nif err != nil {\n    if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {\n        return map[string]bool{}, nil // empty map is a safe default\n    }\n    return fmt.Errorf(\"GetInfraTypes: %w\", err)\n}","preventionTips":["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."],"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"}