{"record":{"id":"4b2cdf9664ce67cf","repo":"quickwit-oss/quickwit","slug":"min-connections-must-be-less-than-or-equal-to-m","errorCode":null,"errorMessage":"`min_connections` must be less than or equal to `max_connections`","messagePattern":"`min_connections` must be less than or equal to `max_connections`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-config/src/metastore_config.rs","lineNumber":256,"sourceCode":"        if self.max_connection_lifetime.is_empty() || self.max_connection_lifetime == \"0\" {\n            return Ok(None);\n        }\n        let max_connection_lifetime =\n            parse_duration(&self.max_connection_lifetime).with_context(|| {\n                format!(\n                    \"failed to parse `max_connection_lifetime` value `{}`\",\n                    self.max_connection_lifetime\n                )\n            })?;\n        if max_connection_lifetime.is_zero() {\n            Ok(None)\n        } else {\n            Ok(Some(max_connection_lifetime))\n        }\n    }\n\n    pub fn validate(&self) -> anyhow::Result<()> {\n        ensure!(\n            self.min_connections <= self.max_connections.get(),\n            \"`min_connections` must be less than or equal to `max_connections`\"\n        );\n        self.acquire_connection_timeout()?;\n        self.idle_connection_timeout_opt()?;\n        self.max_connection_lifetime_opt()?;\n        Ok(())\n    }\n}\n\n#[derive(Debug, Clone, Default, Eq, PartialEq, Serialize, Deserialize)]\n#[serde(deny_unknown_fields)]\npub struct FileMetastoreConfig;\n\nimpl FileMetastoreConfig {\n    pub fn validate(&self) -> anyhow::Result<()> {\n        Ok(())\n    }","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-config/src/metastore_config.rs#L238-L274","documentation":"PostgresMetastoreConfig::validate enforces that the connection pool's `min_connections` does not exceed `max_connections`. A pool whose lower bound exceeds its upper bound is contradictory and cannot be constructed by sqlx's pool.","triggerScenarios":"Configuring `metastore.postgres.min_connections` greater than `metastore.postgres.max_connections` (e.g. min: 20, max: 10) and running node config validation at startup.","commonSituations":"Tuning pool sizes independently and forgetting the relationship; raising min_connections to 'warm' the pool past an old max value; environment variable overrides raising min while config file sets max lower.","solutions":["Lower `min_connections` to be <= `max_connections`, e.g. min: 5, max: 10.","Or raise `max_connections` to at least `min_connections` if a large warm pool is intended.","Check env var overrides (QW_METASTORE_POSTGRES_MIN_CONNECTIONS etc.) that may silently change one of the two values.","Note max_connections is a NonZeroU32 — ensure it is also > 0."],"exampleFix":"# before\npostgres:\n  min_connections: 20\n  max_connections: 10\n# after\npostgres:\n  min_connections: 5\n  max_connections: 10","handlingStrategy":"validation","validationCode":"if (cfg.min_connections > cfg.max_connections || cfg.max_connections === 0) {\n  throw new Error('min_connections must be <= max_connections and max_connections > 0');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Tune min and max connection pool sizes together, always checking min <= max.","Audit QW_METASTORE_POSTGRES_* env overrides whenever either limit is changed.","Keep a sane default pair (e.g. min 5 / max 10) unless profiling justifies otherwise.","Remember max_connections must be non-zero (NonZeroU32)."],"tags":["config","validation","postgres","connection-pool"],"backgroundTag":"invalid-config-value","analyzedSha":"a39730c5cdcd1a4fe798403737ae293999ea21f8","analyzedAt":"2026-09-08T13:19:37.784Z","contentChangedAt":"2026-09-08T13:19:37.784Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}