{"record":{"id":"609b7503a401e421","repo":"reacherhq/check-if-email-exists","slug":"when-worker-mode-is-enabled-a-postgres-database-m","errorCode":null,"errorMessage":"When worker mode is enabled, a Postgres database must be configured.","messagePattern":"When worker mode is enabled, a Postgres database must be configured\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"backend/src/config.rs","lineNumber":334,"sourceCode":"\n/// Load the worker configuration from the worker_config.toml file and from the\n/// environment.\npub async fn load_config() -> Result<BackendConfig, anyhow::Error> {\n\tlet cfg = Config::builder()\n\t\t.add_source(config::File::with_name(\"backend_config\"))\n\t\t.add_source(config::Environment::with_prefix(\"RCH\").separator(\"__\"));\n\n\tlet cfg = cfg.build()?.try_deserialize::<BackendConfig>()?;\n\n\t// Perform additional checks\n\n\t// 1. Make sure that if the worker is enabled, a Postgres database is configured.\n\tif cfg.worker.enable {\n\t\twarn!(target: LOG_TARGET, \"The worker feature is currently in beta. Please send any feedback to amaury@reacher.email.\");\n\n\t\tmatch &cfg.storage {\n\t\t\tSome(StorageConfig::Postgres(_)) => {}\n\t\t\t_ => bail!(\"When worker mode is enabled, a Postgres database must be configured.\"),\n\t\t}\n\t}\n\n\t// 2. Validate the verif_method proxies, meaning that for each email\n\t// provider's verification method, the proxy (if set) must exist in the\n\t// `proxies` field.\n\tcfg.get_verif_method().validate_proxies()?;\n\n\tOk(cfg)\n}\n\n#[cfg(test)]\nmod tests {\n\tuse super::*;\n\tuse serial_test::serial;\n\tuse std::{env, time::Duration};\n\tuse {\n\t\tEverythingElseVerifMethod, GmailVerifMethod, HotmailB2BVerifMethod, VerifMethodSmtpConfig,","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/reacherhq/check-if-email-exists/blob/81da93e8a419f601c05e1bcf4a197d25eb0e349d/backend/src/config.rs#L316-L352","documentation":"load_config validates that when the worker feature is enabled (cfg.worker.enable), the storage field is configured as Postgres. Any other storage (or none) makes it bail with 'When worker mode is enabled, a Postgres database must be configured.' The worker persists job state in Postgres, so this is a hard requirement.","triggerScenarios":"Running the backend with worker.enable = true while storage is None or set to a non-Postgres StorageConfig variant.","commonSituations":"Worker beta flag turned on in a deployment that previously used no database; copying an API-server config and enabling worker without adding the Postgres storage section; storage key typo so it deserializes as None.","solutions":["Add a [storage.postgres] section with the database URL to the config","If no database is intended, disable worker mode (worker.enable = false)","Verify the storage key spelling so it parses as StorageConfig::Postgres"],"exampleFix":"// before\n[worker]\nenable = true\n// no storage configured -> bail\n// after\n[worker]\nenable = true\n\n[storage.postgres]\nurl = \"postgres://user:pass@localhost/reacher\"","handlingStrategy":"validation","validationCode":"if config.worker.enable\n    && !matches!(&config.storage, Some(StorageConfig::Postgres(_)))\n{\n    eprintln!(\"Worker mode requires [storage.postgres] to be configured\");\n    std::process::exit(1);\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = load_config() {\n    if e.to_string().contains(\"Postgres database must be configured\") {\n        eprintln!(\"Add [storage.postgres] or disable worker mode\");\n    }\n    return Err(e);\n}","preventionTips":["Whenever enabling worker mode, also configure storage.postgres","Keep a validated example config for worker deployments","Check for key-name typos (storage) that silently become None"],"tags":["config","worker","postgres","validation"],"backgroundTag":"missing-required-config-field","analyzedSha":"81da93e8a419f601c05e1bcf4a197d25eb0e349d","analyzedAt":"2026-09-11T10:06:14.663Z","contentChangedAt":"2026-09-11T10:06:14.663Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}