{"record":{"id":"40053120ed47f762","repo":"reacherhq/check-if-email-exists","slug":"worker-configuration-is-missing","errorCode":null,"errorMessage":"Worker configuration is missing","messagePattern":"Worker configuration is missing","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"backend/src/config.rs","lineNumber":184,"sourceCode":"\t\t\t\t.unwrap_or(YahooVerifMethod::Headless),\n\t\t\teverything_else: EverythingElseVerifMethod::Smtp(default_smtp_config),\n\t\t}\n\t}\n\n\t/// Get the worker configuration.\n\t///\n\t/// # Panics\n\t///\n\t/// Panics if the worker configuration is missing.\n\tpub fn must_worker_config(&self) -> Result<MustWorkerConfig, anyhow::Error> {\n\t\tmatch (self.worker.enable, &self.worker.rabbitmq, &self.channel) {\n\t\t\t(true, Some(rabbitmq), Some(channel)) => Ok(MustWorkerConfig {\n\t\t\t\tchannel: channel.clone(),\n\t\t\t\trabbitmq: rabbitmq.clone(),\n\t\t\t\twebhook: self.worker.webhook.clone(),\n\t\t\t}),\n\n\t\t\t(true, _, _) => bail!(\"Worker configuration is missing\"),\n\t\t\t_ => bail!(\"Calling must_worker_config on a non-worker backend\"),\n\t\t}\n\t}\n\n\t/// Attempt connection to the Postgres database and RabbitMQ. Also populates\n\t/// the internal `pg_pool` and `channel` fields with the connections.\n\tpub async fn connect(&mut self) -> Result<(), anyhow::Error> {\n\t\tmatch &self.storage {\n\t\t\tSome(StorageConfig::Postgres(config)) => {\n\t\t\t\tlet storage = PostgresStorage::new(&config.db_url, config.extra.clone())\n\t\t\t\t\t.await\n\t\t\t\t\t.with_context(|| format!(\"Connecting to postgres DB {}\", config.db_url))?;\n\n\t\t\t\tself.storage_adapter = Arc::new(StorageAdapter::Postgres(storage));\n\t\t\t}\n\t\t\t_ => {\n\t\t\t\tself.storage_adapter = Arc::new(StorageAdapter::Noop);\n\t\t\t}","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/reacherhq/check-if-email-exists/blob/81da93e8a419f601c05e1bcf4a197d25eb0e349d/backend/src/config.rs#L166-L202","documentation":"must_worker_config builds a MustWorkerConfig only when the backend is a worker (first match arm true) and both rabbitmq and channel are Some. If worker mode is on but RabbitMQ or its channel was not configured/connected, it bails with 'Worker configuration is missing'.","triggerScenarios":"Calling must_worker_config on a backend whose config has worker.enable = true but where the rabbitmq config section or an established channel is absent (connect() not called or rabbitmq block missing).","commonSituations":"Enabling worker mode in config but forgetting the [rabbitmq] section; calling must_worker_config before connect() established the AMQP channel; config file merge dropping the rabbitmq key.","solutions":["Add the rabbitmq configuration section (URL, credentials) to the backend config","Call connect() before must_worker_config so the channel is populated","Verify the config file actually loads the rabbitmq key (no typo like rabbitMQ)"],"exampleFix":"// before\n[worker]\nenable = true\n// missing rabbitmq section -> bail\n// after\n[worker]\nenable = true\n\n[rabbitmq]\nurl = \"amqp://guest:guest@localhost:5672\"","handlingStrategy":"validation","validationCode":"if config.worker.enable && config.rabbitmq.is_none() {\n    eprintln!(\"Worker mode requires a [rabbitmq] config section\");\n    std::process::exit(1);\n}","typeGuard":null,"tryCatchPattern":"match backend.must_worker_config().await {\n    Err(e) if e.to_string().contains(\"Worker configuration is missing\") => {\n        eprintln!(\"Enable RabbitMQ config and call connect() first: {e}\");\n    }\n    Err(e) => return Err(e),\n    Ok(cfg) => cfg,\n}","preventionTips":["Always include the rabbitmq section when worker.enable = true","Call connect() before must_worker_config","Add a config-file validation step at startup"],"tags":["config","worker","rabbitmq","missing-config"],"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-15T23:17:13.987Z"}