JuliusBrussee/caveman · error
postgres: parse DATABASE_URL: %w
Error message
postgres: parse DATABASE_URL: %w
What it means
Error "postgres: parse DATABASE_URL: %w" thrown in JuliusBrussee/caveman.
Source
Thrown at shared/platform/postgresconfig/postgresconfig.go:43
// ParsePoolConfig validates the connection string and applies the managed
// database CA to every TLS path. Production rejects sslmode=require because it
// encrypts without authenticating the server; verify-full is mandatory.
func ParsePoolConfig(databaseURL string) (*pgxpool.Config, error) {
production := runtimeenv.IsProduction()
if production {
parsed, err := url.Parse(databaseURL)
if err != nil || (parsed.Scheme != "postgres" && parsed.Scheme != "postgresql") || parsed.Hostname() == "" {
return nil, errors.New("postgres: production DATABASE_URL must be a Postgres URL")
}
if parsed.Query().Get("sslmode") != "verify-full" {
return nil, errors.New("postgres: production DATABASE_URL requires sslmode=verify-full")
}
}
config, err := pgxpool.ParseConfig(databaseURL)
if err != nil {
return nil, fmt.Errorf("postgres: parse DATABASE_URL: %w", err)
}
caPEM, err := caPEMFromEnvironment()
if err != nil {
return nil, err
}
if production && caPEM == "" {
return nil, fmt.Errorf("postgres: %s or %s is required in production", caEnvironment, caFileEnvironment)
}
if caPEM == "" {
return config, nil
}
roots := x509.NewCertPool()
if !roots.AppendCertsFromPEM([]byte(caPEM)) {
return nil, fmt.Errorf("postgres: %s contains no valid certificate", caEnvironment)
}
if config.ConnConfig.TLSConfig == nil {
return nil, errors.New("postgres: CA certificate configured while TLS is disabled")
}View on GitHub (pinned to 27d5a3981a)
Solutions
- Fix DATABASE_URL so it parses as a Postgres URL.
When it happens
Trigger: Thrown at shared/platform/postgresconfig/postgresconfig.go:43 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15).
Data as JSON: /api/errors/cb08814339f86b7d.
Report an issue: GitHub.