JuliusBrussee/caveman · error
postgres: %s or %s is required in production
Error message
postgres: %s or %s is required in production
What it means
Error "postgres: %s or %s is required in production" thrown in JuliusBrussee/caveman.
Source
Thrown at shared/platform/postgresconfig/postgresconfig.go:50
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")
}
config.ConnConfig.TLSConfig.RootCAs = roots
config.ConnConfig.TLSConfig.InsecureSkipVerify = false
config.ConnConfig.TLSConfig.ServerName = config.ConnConfig.Host
for _, fallback := range config.ConnConfig.Fallbacks {
if fallback.TLSConfig == nil {
if production {
return nil, errors.New("postgres: production connection includes a plaintext fallback")View on GitHub (pinned to 27d5a3981a)
Solutions
- Set one of the required Postgres environment variables in production.
When it happens
Trigger: Thrown at shared/platform/postgresconfig/postgresconfig.go:50 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/3e5fcaef040b3605.
Report an issue: GitHub.