{"record":{"id":"5ea4d47fde52db7e","repo":"EpicGames/lore","slug":"failed-to-start-http-server-err","errorCode":null,"errorMessage":"Failed to start HTTP server: {err}","messagePattern":"Failed to start HTTP server: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"lore-server/src/http/server.rs","lineNumber":282,"sourceCode":"            axum::serve(listener, app)\n                .with_graceful_shutdown(signal)\n                .await\n        })\n        .await??;\n\n        Ok(())\n    }\n\n    pub async fn serve(\n        settings: LoreHttpServerSettings,\n        immutable_store: Arc<dyn lore_storage::ImmutableStore>,\n        mutable_store: Arc<dyn lore_storage::MutableStore>,\n        jwt_verifier: Option<JwtVerifier>,\n        repository_authorizer: Arc<dyn RepositoryAuthorizer>,\n        signal: impl Future<Output = ()> + Send + 'static,\n    ) -> Result<()> {\n        let addr = SocketAddr::from_str(format!(\"{}:{}\", settings.host, settings.port).as_str())\n            .map_err(|err| anyhow!(\"Failed to start HTTP server: {err}\"))?;\n        info!(\n            \"Starting Lore HTTP Server: {}, Auth: {}\",\n            &addr,\n            jwt_verifier.as_ref().map_or(\"no\", |_| \"yes\")\n        );\n\n        let health = ServerHealth {\n            immutable_store: Arc::downgrade(&immutable_store),\n            available: AtomicBool::new(true),\n            interval_timeout: if settings.available_interval_seconds > 0\n                && settings.available_timeout_seconds > 0\n            {\n                Some((\n                    Duration::from_secs(settings.available_interval_seconds),\n                    Duration::from_secs(settings.available_timeout_seconds),\n                ))\n            } else {\n                None","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/EpicGames/lore/blob/074eb0b0d1194c997d7cf28b55519e3e197b3e23/lore-server/src/http/server.rs#L264-L300","documentation":"serve (the main Lore HTTP server) parses settings.host:settings.port into a SocketAddr; invalid values are wrapped as \"Failed to start HTTP server\". The main API server never starts when the address is unparseable.","triggerScenarios":"ServerSettings.host is not a parseable IP literal (DNS hostname, empty string) or settings.port is out of range/non-numeric when calling serve.","commonSituations":"Deployments set host to a DNS name; port configured via env var with garbage or a service name; empty host after templating failed; IPv6 literal missing brackets.","solutions":["Set host to an IP literal such as 0.0.0.0 and port to a numeric value 0–65535.","Validate the env/config values feeding ServerSettings before launch.","Resolve hostnames to IPs ahead of time; SocketAddr::from_str does not perform DNS lookups.","Wrap IPv6 addresses in brackets in surrounding tooling if they appear in URLs (not needed for the IP field itself)."],"exampleFix":"// before\nhost = \"lore.example.com\"\nport = \"https\"\n// after\nhost = \"0.0.0.0\"\nport = 8080","handlingStrategy":"validation","validationCode":"format!(\"{}:{}\", settings.host, settings.port)\n    .parse::<std::net::SocketAddr>()\n    .map_err(|e| format!(\"invalid server addr: {e}\"))?;","typeGuard":null,"tryCatchPattern":"if let Err(e) = server.serve(...).await {\n    if e.to_string().contains(\"Failed to start HTTP server\") {\n        eprintln!(\"check host/port in ServerSettings: {e}\");\n        std::process::exit(1);\n    }\n    return Err(e);\n}","preventionTips":["Default to host=0.0.0.0 and a numeric port; validate env vars before constructing settings.","Never put hostnames in IP fields; resolve DNS outside config if needed.","Fail fast with a config dump at startup when parsing fails."],"tags":["network","config","address-parsing","startup"],"backgroundTag":"invalid-url-format","analyzedSha":"074eb0b0d1194c997d7cf28b55519e3e197b3e23","analyzedAt":"2026-09-13T09:00:57.509Z","contentChangedAt":"2026-09-13T09:00:57.509Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}