{"record":{"id":"e4d46530a06e1ab3","repo":"JuliusBrussee/caveman","slug":"postgres-s-must-point-to-a-regular-file","errorCode":null,"errorMessage":"postgres: %s must point to a regular file","messagePattern":"postgres: (.+?) must point to a regular file","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/postgresconfig/postgresconfig.go","lineNumber":93,"sourceCode":"\t}\n\treturn config, nil\n}\n\nfunc caPEMFromEnvironment() (string, error) {\n\tfilePath := strings.TrimSpace(os.Getenv(caFileEnvironment))\n\tdirect := strings.TrimSpace(os.Getenv(caEnvironment))\n\tif filePath != \"\" && direct != \"\" {\n\t\treturn \"\", fmt.Errorf(\"postgres: set only %s or %s, not both\", caFileEnvironment, caEnvironment)\n\t}\n\tif filePath == \"\" {\n\t\treturn direct, nil\n\t}\n\tinfo, err := os.Stat(filePath)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"postgres: %s: %w\", caFileEnvironment, err)\n\t}\n\tif !info.Mode().IsRegular() {\n\t\treturn \"\", fmt.Errorf(\"postgres: %s must point to a regular file\", caFileEnvironment)\n\t}\n\tcontents, err := os.ReadFile(filePath)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"postgres: read %s: %w\", caFileEnvironment, err)\n\t}\n\treturn strings.TrimSpace(string(contents)), nil\n}\n\n// NewPool constructs a pool from the hardened configuration.\nfunc NewPool(ctx context.Context, databaseURL string) (*pgxpool.Pool, error) {\n\tconfig, err := ParsePoolConfig(databaseURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn pgxpool.NewWithConfig(ctx, config)\n}\n\n// NewRuntimePool constructs a pool and proves the connected login is a","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/shared/platform/postgresconfig/postgresconfig.go#L75-L111","documentation":"Error \"postgres: %s must point to a regular file\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at shared/platform/postgresconfig/postgresconfig.go:93 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Point the variable at a regular file."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}