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

Worker configuration is missing the rabbitmq configuration

Error message

Worker configuration is missing the rabbitmq configuration

What it means

The backend can be run in worker mode (worker.enable = true), in which case it must connect to RabbitMQ. This error is raised during connect() when worker mode is enabled but the worker.rabbitmq configuration section is entirely absent from the config file, so setup_rabbit_mq cannot be called.

Solutions

  1. Add the [worker.rabbitmq] section with connection settings (host, port, credentials) to the config file.
  2. Alternatively set worker.enable = false if RabbitMQ connectivity is not needed.
  3. Verify the key is exactly rabbitmq (no typo) in the TOML/YAML config.
  4. Check which config file the process actually loads (path/env override) and edit that one.

Example fix

// before (config)
[worker]
enable = true
// after
[worker]
enable = true

[worker.rabbitmq]
uri = "amqp://guest:guest@localhost:5672/%2f"
Defensive patterns

Strategy: validation

Validate before calling

if config.worker.enable && config.worker.rabbitmq.is_none() {
    return Err(anyhow!("worker.enable=true requires [worker.rabbitmq] in the config"));
}

Type guard

fn rabbitmq_ready(enable: bool, rabbitmq: &Option<RabbitMqConfig>) -> bool {
    !enable || rabbitmq.is_some()
}

Prevention

When it happens

Trigger: Config file contains [worker] with enable = true but no [worker.rabbitmq] section; connect() reads self.worker.rabbitmq, gets None via as_ref().ok_or_else(...), and returns the error before calling setup_rabbit_mq.

Common situations: Users enabling workers after copying a minimal config that only has [worker]; switching from HTTP-only deployment to queue-based deployment without adding RabbitMQ settings; typos in the TOML key (e.g. [worker.rabbit_mq]) that deserialize to nothing.

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/2a68e6998fe29f19. Report an issue: GitHub.

Appendix: source

Thrown at backend/src/config.rs:207

	/// 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);
			}
		}

		let channel = if self.worker.enable {
			let rabbitmq_config = self.worker.rabbitmq.as_ref().ok_or_else(|| {
				anyhow::anyhow!("Worker configuration is missing the rabbitmq configuration")
			})?;
			let channel = setup_rabbit_mq(&self.backend_name, rabbitmq_config).await?;
			Some(Arc::new(channel))
		} else {
			None
		};
		self.channel = channel;

		// Initialize throttle manager
		self.throttle_manager = Arc::new(ThrottleManager::new(self.throttle.clone()));

		Ok(())
	}

	/// Get the Postgres connection pool, if the storage is Postgres.
	pub fn get_storage_adapter(&self) -> Arc<StorageAdapter> {
		self.storage_adapter.clone()
	}

View on GitHub (pinned to 81da93e8a4)