{"record":{"id":"e60a59b4420fb9b9","repo":"vectordotdev/vector","slug":"http-uri-not-valid","errorCode":null,"errorMessage":"HTTP URI not valid","messagePattern":"HTTP URI not valid","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/components/validation/resources/http.rs","lineNumber":553,"sourceCode":"            error!(error = ?e, \"HTTP server encountered an error.\");\n        }\n\n        http_server_completed.mark_as_done();\n    });\n\n    (resource_notifier, http_server_shutdown_tx)\n}\n\nfn socketaddr_from_uri(uri: &Uri) -> SocketAddr {\n    let uri_port = uri.port_u16().unwrap_or(80);\n    let uri_host = uri\n        .host()\n        .ok_or_else(|| \"host must be present in URI\".to_string())\n        .and_then(|host| {\n            IpAddr::from_str(host)\n                .map_err(|_| \"URI host must be valid IPv4/IPv6 address\".to_string())\n        })\n        .expect(\"HTTP URI not valid\");\n\n    SocketAddr::from((uri_host, uri_port))\n}\n","sourceCodeStart":535,"sourceCodeEnd":557,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/components/validation/resources/http.rs#L535-L557","documentation":"socketaddr_from_uri parses an HTTP URI to a SocketAddr for the validation HTTP server. It panics with \"HTTP URI not valid\" when the URI has no host, or the host is not a literal IPv4/IPv6 address (e.g. a DNS name), or the port cannot be parsed. The validation framework requires a raw socket address, not a resolvable hostname.","triggerScenarios":"Calling spawn_http_server with a URI like \"http://localhost:8080\" or \"http://example.com\" (DNS name) or a URI missing the host/port entirely; any value that fails IpAddr::from_str or lacks uri.host().","commonSituations":"Pointing a validation test config at \"localhost\" instead of \"127.0.0.1\"; omitting the port; using a hostname that was valid in other Vector configs where DNS resolution is allowed.","solutions":["Replace the hostname in the URI with a literal IP address, e.g. http://127.0.0.1:8080.","Ensure the URI includes both host and port components.","Resolve the hostname to an IP beforehand and pass the IP form of the URI."],"exampleFix":"// before\nlet uri = \"http://localhost:8080\";\n// after\nlet uri = \"http://127.0.0.1:8080\";","handlingStrategy":"validation","validationCode":"fn is_socketaddr_uri(u: &str) -> bool {\n    url::Url::parse(u).ok()\n        .and_then(|uri| uri.host_str().map(|h| h.parse::<std::net::IpAddr>().is_ok()))\n        .unwrap_or(false)\n        && url::Url::parse(u).unwrap().port().is_some()\n}\n// assert!(is_socketaddr_uri(\"http://127.0.0.1:8080\"));","typeGuard":"fn has_ip_host(u: &url::Url) -> Option<std::net::IpAddr> {\n    u.host_str()?.parse::<std::net::IpAddr>().ok()\n}","tryCatchPattern":null,"preventionTips":["Always use literal IPs (127.0.0.1, ::1) in validation URIs, never hostnames.","Include an explicit port in every HTTP URI used for validation endpoints.","Validate the URI parses with an IP host before passing it into the harness."],"tags":["http","uri","panic","validation"],"backgroundTag":"invalid-url-format","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}