reacherhq/check-if-email-exists · error · anyhow::Error

Worker configuration is missing

Error message

Worker configuration is missing

What it means

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'.

Solutions

  1. Add the rabbitmq configuration section (URL, credentials) to the backend config
  2. Call connect() before must_worker_config so the channel is populated
  3. Verify the config file actually loads the rabbitmq key (no typo like rabbitMQ)

Example fix

// before
[worker]
enable = true
// missing rabbitmq section -> bail
// after
[worker]
enable = true

[rabbitmq]
url = "amqp://guest:guest@localhost:5672"
Defensive patterns

Strategy: validation

Validate before calling

if config.worker.enable && config.rabbitmq.is_none() {
    eprintln!("Worker mode requires a [rabbitmq] config section");
    std::process::exit(1);
}

Try / catch

match backend.must_worker_config().await {
    Err(e) if e.to_string().contains("Worker configuration is missing") => {
        eprintln!("Enable RabbitMQ config and call connect() first: {e}");
    }
    Err(e) => return Err(e),
    Ok(cfg) => cfg,
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of reacherhq/check-if-email-exists@81da93e8a4 (2026-09-11). Data as JSON: /api/errors/40053120ed47f762. Report an issue: GitHub.

Appendix: source

Thrown at backend/src/config.rs:184

				.unwrap_or(YahooVerifMethod::Headless),
			everything_else: EverythingElseVerifMethod::Smtp(default_smtp_config),
		}
	}

	/// Get the worker configuration.
	///
	/// # Panics
	///
	/// Panics if the worker configuration is missing.
	pub fn must_worker_config(&self) -> Result<MustWorkerConfig, anyhow::Error> {
		match (self.worker.enable, &self.worker.rabbitmq, &self.channel) {
			(true, Some(rabbitmq), Some(channel)) => Ok(MustWorkerConfig {
				channel: channel.clone(),
				rabbitmq: rabbitmq.clone(),
				webhook: self.worker.webhook.clone(),
			}),

			(true, _, _) => bail!("Worker configuration is missing"),
			_ => bail!("Calling must_worker_config on a non-worker backend"),
		}
	}

	/// Attempt connection to the Postgres database and RabbitMQ. Also populates
	/// the internal `pg_pool` and `channel` fields with the connections.
	pub async fn connect(&mut self) -> Result<(), anyhow::Error> {
		match &self.storage {
			Some(StorageConfig::Postgres(config)) => {
				let storage = PostgresStorage::new(&config.db_url, config.extra.clone())
					.await
					.with_context(|| format!("Connecting to postgres DB {}", config.db_url))?;

				self.storage_adapter = Arc::new(StorageAdapter::Postgres(storage));
			}
			_ => {
				self.storage_adapter = Arc::new(StorageAdapter::Noop);
			}

View on GitHub (pinned to 81da93e8a4)