{"record":{"id":"4dd0f125bfe0a4de","repo":"nautechsystems/nautilus_trader","slug":"invalid-description-endpoint","errorCode":null,"errorMessage":"Invalid {description} endpoint","messagePattern":"Invalid (.+?) endpoint","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/rpc/http.rs","lineNumber":917,"sourceCode":"            return Err(BroadcastError::Rejected { code: error.code });\n        }\n\n        let hex_string = parsed\n            .result\n            .ok_or_else(|| BroadcastError::Failed(\"Broadcast returned no result\".to_string()))?;\n\n        B256::from_str(&hex_string)\n            .map_err(|e| BroadcastError::Failed(format!(\"Failed to parse broadcast result: {e}\")))\n    }\n}\n\n#[cfg(feature = \"hypersync\")]\npub(crate) fn validate_execution_endpoint(\n    endpoint: &str,\n    description: &str,\n) -> anyhow::Result<Url> {\n    let url =\n        Url::parse(endpoint).map_err(|_| anyhow::anyhow!(\"Invalid {description} endpoint\"))?;\n    anyhow::ensure!(\n        matches!(url.scheme(), \"http\" | \"https\"),\n        \"{description} endpoint must use HTTPS or canonical loopback HTTP\"\n    );\n    anyhow::ensure!(\n        url.host().is_some(),\n        \"{description} endpoint host is required\"\n    );\n    anyhow::ensure!(\n        url.fragment().is_none(),\n        \"{description} endpoint fragments are unsupported\"\n    );\n    anyhow::ensure!(\n        url.scheme() == \"https\" || is_canonical_loopback_endpoint(endpoint),\n        \"{description} endpoint must use HTTPS unless its host is a canonical loopback IP literal\"\n    );\n    Ok(url)\n}","sourceCodeStart":899,"sourceCodeEnd":935,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/rpc/http.rs#L899-L935","documentation":"Thrown by `validate_execution_endpoint` when the endpoint string cannot be parsed as a URL at all. This is the first gate in endpoint validation: before scheme/host/loopback checks, the value must be a well-formed URL. The `description` placeholder names the endpoint's role (e.g. \"execution\").","triggerScenarios":"Passing a string that `Url::parse` rejects to `new`, `normalize_endpoint`, or the endpoint-validation tests — e.g. missing scheme (\"localhost:8545\" is parsed as scheme-only and fails expectations, \"node.internal:8545\"), stray characters, or an empty string.","commonSituations":"Config/env var set without the `http://` or `https://` prefix; copy-pasted endpoint with quotes, spaces, or trailing slashes/garbage; using a Unix-socket style path instead of an http URL.","solutions":["Add an explicit scheme: `https://host:port` (or `http://127.0.0.1:8545` for loopback).","Trim whitespace/quotes from the configured endpoint value in your env/config source.","Print `Url::parse(endpoint)` in a quick REPL/test to see which part of the string is malformed.","Use `normalize_endpoint` to canonicalize before validation where available."],"exampleFix":"// before\nlet endpoint = \"my-node.internal:8545\"; // no scheme -> Url::parse fails\n// after\nlet endpoint = \"https://my-node.internal:8545\";","handlingStrategy":"validation","validationCode":"fn assert_valid_http_url(s: &str) -> Result<(), String> {\n    let url = url::Url::parse(s).map_err(|e| format!(\"not a URL: {e}\"))?;\n    match url.scheme() {\n        \"http\" | \"https\" => Ok(()),\n        other => Err(format!(\"scheme {other} not http/https\")),\n    }\n}\n// call before constructing the client: assert_valid_http_url(&endpoint).unwrap();","typeGuard":"fn is_http_url(s: &str) -> bool {\n    url::Url::parse(s).map(|u| matches!(u.scheme(), \"http\" | \"https\")).unwrap_or(false)\n}","tryCatchPattern":"let client = HttpRpcClient::new(&endpoint).map_err(|e| {\n    anyhow::anyhow!(\"bad execution endpoint '{endpoint}': {e}\")\n})?;","preventionTips":["Always include an explicit scheme (https://) in configured endpoints.","Trim whitespace/quotes when loading endpoints from env or config files.","Fail fast at startup with a URL parse check instead of mid-run."],"tags":["url","config","validation"],"backgroundTag":"invalid-url-format","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}