{"record":{"id":"742be75cb0022d01","repo":"reacherhq/check-if-email-exists","slug":"invalid-host","errorCode":null,"errorMessage":"Invalid host: {}","messagePattern":"Invalid host: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"backend/src/http/mod.rs","lineNumber":70,"sourceCode":"\t\t))\n\t\t.or(v1::bulk::get_results::v1_get_bulk_job_results(config))\n\t\t.recover(handle_rejection)\n}\n\n/// Runs the Warp server.\n///\n/// This function starts the Warp server and listens for incoming requests.\n/// It returns a `Result` indicating whether the server started successfully or\n/// encountered an error, as well as an optional `JobRunnerHandle` if the bulk\n/// job listener is enabled. The handle can be used to stop the listener or to\n/// keep it alive.\npub async fn run_warp_server(\n\tconfig: Arc<BackendConfig>,\n) -> Result<Option<JobRunnerHandle>, anyhow::Error> {\n\tlet host = config\n\t\t.http_host\n\t\t.parse::<IpAddr>()\n\t\t.unwrap_or_else(|_| panic!(\"Invalid host: {}\", config.http_host));\n\t// For backwards compatibility, we allow the port to be set via the\n\t// environment variable PORT, instead of the new configuration file. The\n\t// PORT environment variable takes precedence.\n\tlet port = env::var(\"PORT\")\n\t\t.map(|port: String| {\n\t\t\tport.parse::<u16>()\n\t\t\t\t.unwrap_or_else(|_| panic!(\"Invalid port: {}\", port))\n\t\t})\n\t\t.unwrap_or(config.http_port);\n\n\tlet routes = create_routes(Arc::clone(&config));\n\n\t// Run v0 bulk job listener.\n\tlet is_bulk_enabled = env::var(\"RCH_ENABLE_BULK\").unwrap_or_else(|_| \"0\".into()) == \"1\";\n\tlet runner = if is_bulk_enabled {\n\t\tlet pg_pool = config.get_pg_pool().expect(\n\t\t\t\"Please set the RCH__STORAGE__POSTGRES__DB_URL environment when RCH_ENABLE_BULK is set\",\n\t\t);","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/reacherhq/check-if-email-exists/blob/81da93e8a419f601c05e1bcf4a197d25eb0e349d/backend/src/http/mod.rs#L52-L88","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","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"],"exampleFix":"// before\nhttp_host = \"localhost\"\n// after\nhttp_host = \"127.0.0.1\"","handlingStrategy":"validation","validationCode":"use std::net::IpAddr;\nif config.http_host.parse::<IpAddr>().is_err() {\n    eprintln!(\"http_host '{}' is not a valid IP address\", config.http_host);\n    std::process::exit(1);\n}","typeGuard":"fn is_valid_host(host: &str) -> bool { host.parse::<std::net::IpAddr>().is_ok() }","tryCatchPattern":null,"preventionTips":["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"],"tags":["config","panic","startup","invalid-host"],"backgroundTag":"invalid-config-value","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"}