reacherhq/check-if-email-exists · critical
Invalid host
Error message
Invalid host: {} What it means
run_warp_server parses config.http_host into an IpAddr at startup. If the configured HTTP host is not a valid IP address (e.g. a hostname like 'localhost' or a malformed value), the unwrap_or_else panics with 'Invalid host: {}'. This is a fail-fast guard because warp's bind requires an IP address.
Solutions
- Set http_host to a valid IP address, e.g. 127.0.0.1 or 0.0.0.0
- If you need hostname resolution, resolve it to an IP before passing it in config
- Check the HTTP_HOST environment variable / config file for typos or empty values
Example fix
// before http_host = "localhost" // after http_host = "127.0.0.1"
Defensive patterns
Strategy: validation
Validate before calling
use std::net::IpAddr;
if config.http_host.parse::<IpAddr>().is_err() {
eprintln!("http_host '{}' is not a valid IP address", config.http_host);
std::process::exit(1);
} Type guard
fn is_valid_host(host: &str) -> bool { host.parse::<std::net::IpAddr>().is_ok() } Prevention
- Always use IP literals (127.0.0.1, 0.0.0.0) for http_host
- Validate config at load time, before starting the server
- Document that hostnames are not supported in http_host
When it happens
Trigger: Calling run_warp_server (directly or via main) with BackendConfig.http_host set to a non-IP string such as 'localhost', an empty string, or a typo like '0.0.0.0:8080'.
Common situations: Setting http.host in the config file or HTTP_HOST env var to 'localhost' instead of '127.0.0.1'; leaving the field blank; copying a 'host:port' string into the host field.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Invalid port
- Worker configuration is missing the rabbitmq configuration
- Worker configuration is missing
- Calling must_worker_config on a non-worker backend
- When worker mode is enabled, a Postgres database must be…
AI-assisted analysis of reacherhq/check-if-email-exists@81da93e8a4 (2026-09-11).
Data as JSON: /api/errors/742be75cb0022d01.
Report an issue: GitHub.
Appendix: source
Thrown at backend/src/http/mod.rs:70
))
.or(v1::bulk::get_results::v1_get_bulk_job_results(config))
.recover(handle_rejection)
}
/// Runs the Warp server.
///
/// This function starts the Warp server and listens for incoming requests.
/// It returns a `Result` indicating whether the server started successfully or
/// encountered an error, as well as an optional `JobRunnerHandle` if the bulk
/// job listener is enabled. The handle can be used to stop the listener or to
/// keep it alive.
pub async fn run_warp_server(
config: Arc<BackendConfig>,
) -> Result<Option<JobRunnerHandle>, anyhow::Error> {
let host = config
.http_host
.parse::<IpAddr>()
.unwrap_or_else(|_| panic!("Invalid host: {}", config.http_host));
// For backwards compatibility, we allow the port to be set via the
// environment variable PORT, instead of the new configuration file. The
// PORT environment variable takes precedence.
let port = env::var("PORT")
.map(|port: String| {
port.parse::<u16>()
.unwrap_or_else(|_| panic!("Invalid port: {}", port))
})
.unwrap_or(config.http_port);
let routes = create_routes(Arc::clone(&config));
// Run v0 bulk job listener.
let is_bulk_enabled = env::var("RCH_ENABLE_BULK").unwrap_or_else(|_| "0".into()) == "1";
let runner = if is_bulk_enabled {
let pg_pool = config.get_pg_pool().expect(
"Please set the RCH__STORAGE__POSTGRES__DB_URL environment when RCH_ENABLE_BULK is set",
);View on GitHub (pinned to 81da93e8a4)