{"record":{"id":"38083e3b7551c151","repo":"ory/kratos","slug":"attempting-to-use-the-option-pool-min-conns-with-38083e","errorCode":null,"errorMessage":"attempting to use the option 'pool_min_conns' with %s, but connection pooling is not supported for this case: dsn=%s","messagePattern":"attempting to use the option 'pool_min_conns' with (.+?), but connection pooling is not supported for this case: dsn=(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"driver/registry_default.go","lineNumber":727,"sourceCode":"\t\t\tURL:             sqlcon.FinalizeDSN(m.l, cleanedDSN),\n\t\t\tIdlePool:        idlePool,\n\t\t\tConnMaxLifetime: connMaxLifetime,\n\t\t\tConnMaxIdleTime: connMaxIdleTime,\n\t\t\tPool:            pool,\n\t\t\tTracerProvider:  m.Tracer(ctx).Provider(),\n\t\t}\n\n\t\tfor _, f := range o.dbOpts {\n\t\t\tf(dbOpts)\n\t\t}\n\n\t\tscheme, _, _ := sqlxx.ExtractSchemeFromDSN(dbOpts.URL)\n\t\tif !dbOpts.AllowMinPool && scheme == \"postgres\" && strings.Contains(dbOpts.URL, \"pool_min_conns=\") {\n\t\t\terr := errors.Errorf(\"attempting to use the option 'pool_min_conns' with Postgres, but the pgxpool connection pool is disabled, this will be rejected by the database: dsn=%s dbOpts.AllowMinPool=%v\", dbOpts.URL, dbOpts.AllowMinPool)\n\t\t\treturn backoff.Permanent(err)\n\t\t}\n\t\tif (scheme == \"sqlite\" || scheme == \"mysql\") && strings.Contains(dbOpts.URL, \"pool_min_conns=\") {\n\t\t\terr := errors.Errorf(\"attempting to use the option 'pool_min_conns' with %s, but connection pooling is not supported for this case: dsn=%s\", scheme, dbOpts.URL)\n\t\t\treturn backoff.Permanent(err)\n\t\t}\n\n\t\tm.Logger().\n\t\t\tWithField(\"pool\", pool).\n\t\t\tWithField(\"idlePool\", idlePool).\n\t\t\tWithField(\"connMaxLifetime\", connMaxLifetime).\n\t\t\tDebug(\"Connecting to SQL Database\")\n\t\tc, err := pop.NewConnection(dbOpts)\n\t\tif err != nil {\n\t\t\tm.Logger().WithError(err).Warnf(\"Unable to connect to database, retrying.\")\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t\tif err := c.Open(); err != nil {\n\t\t\tm.Logger().WithError(err).Warnf(\"Unable to open database, retrying.\")\n\t\t\treturn errors.WithStack(err)\n\t\t}\n\t\tp, err := sql.NewPersister(m, c,","sourceCodeStart":709,"sourceCodeEnd":745,"githubUrl":"https://github.com/ory/kratos/blob/b86338da04a040247a07f46100a86dcfb3875909/driver/registry_default.go#L709-L745","documentation":"Same validation path as the Postgres case: if the DSN scheme is sqlite or mysql and the DSN contains 'pool_min_conns=', connection setup fails immediately with this error because pooling is not supported for those drivers — the option would be meaningless or rejected. It is returned as a permanent error, so retries will not help.","triggerScenarios":"Setting dsn to a 'sqlite://' or 'mysql://' URL that includes '?pool_min_conns=...' (or '&pool_min_conns=...'), e.g. 'mysql://user:pass@db:3306/db?pool_min_conns=2', triggering errors.Errorf at registry_default.go:727 during connection bootstrap.","commonSituations":"Shared configuration templates that append pool tuning parameters for all environments, switching a deployment from Postgres to MySQL/sqlite without cleaning DSN query parameters, and copy-pasted tuning advice from Postgres-focused guides.","solutions":["Remove the 'pool_min_conns=' query parameter from the sqlite/mysql DSN.","Keep pool tuning parameters only in the Postgres configuration where a pool is supported.","If connection limits matter for sqlite/mysql, control them via the DB server or driver-specific settings, not this option.","Grep your config/secrets templates for 'pool_min_conns' and make it Postgres-only."],"exampleFix":"// before\ndsn: mysql://user:pass@tcp(db:3306)/db?pool_min_conns=2\n\n// after\ndsn: mysql://user:pass@tcp(db:3306)/db","handlingStrategy":"validation","validationCode":"scheme, _, _ := sqlxx.ExtractSchemeFromDSN(dsn)\nif strings.Contains(dsn, \"pool_min_conns=\") && (scheme == \"sqlite\" || scheme == \"mysql\") {\n    return fmt.Errorf(\"pool_min_conns is not supported for %s DSNs\", scheme)\n}","typeGuard":null,"tryCatchPattern":"if err := connect(dsn); err != nil {\n    if strings.Contains(err.Error(), \"pool_min_conns\") {\n        return connect(stripQueryParam(dsn, \"pool_min_conns\"))\n    }\n    return err\n}","preventionTips":["Never reuse Postgres-tuned DSN query strings across engines.","Template pool options per-database-driver rather than globally.","Add a pre-deploy check that strips/flags pool_min_conns on non-Postgres DSNs."],"tags":["database","sqlite","mysql","connection-pool","config"],"backgroundTag":"unsupported-config-value","analyzedSha":"b86338da04a040247a07f46100a86dcfb3875909","analyzedAt":"2026-09-07T15:58:15.934Z","contentChangedAt":"2026-09-07T15:58:15.934Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}