{"record":{"id":"48ef905fa14ab973","repo":"FuelLabs/fuel-core","slug":"failed-to-create-fuelclient-no-url-is-provided","errorCode":null,"errorMessage":"Failed to create FuelClient. No URL is provided.","messagePattern":"Failed to create FuelClient\\. No URL is provided\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/client/src/client.rs","lineNumber":459,"sourceCode":"        rpc_url: R,\n    ) -> anyhow::Result<Self> {\n        let urls: Vec<_> = graph_ql_urls\n            .map(|str| normalize_url(str.as_ref()))\n            .try_collect()?;\n        let mut client = Self::with_urls(&urls)?;\n        let mut raw_rpc_url = <R as AsRef<str>>::as_ref(&rpc_url).to_string();\n        if !raw_rpc_url.starts_with(\"http\") {\n            raw_rpc_url = format!(\"http://{raw_rpc_url}\");\n        }\n        let rpc_client = ProtoBlockAggregatorClient::connect(raw_rpc_url).await?;\n        client.rpc_client = Some(rpc_client);\n        client.aws_client = AWSClientManager::new();\n        Ok(client)\n    }\n\n    pub fn with_urls(urls: &[impl AsRef<str>]) -> anyhow::Result<Self> {\n        if urls.is_empty() {\n            return Err(anyhow!(\"Failed to create FuelClient. No URL is provided.\"));\n        }\n        let urls = urls\n            .iter()\n            .map(|url| normalize_url(url.as_ref()))\n            .collect::<Result<Vec<_>, _>>()?;\n        Ok(Self {\n            transport: FailoverTransport::new(urls)?,\n            require_height: ConsistencyPolicy::Auto {\n                height: Arc::new(Mutex::new(None)),\n            },\n            chain_state_info: Default::default(),\n            #[cfg(feature = \"rpc\")]\n            rpc_client: None,\n            #[cfg(feature = \"rpc\")]\n            aws_client: AWSClientManager::new(),\n            #[cfg(feature = \"rpc\")]\n            http_client: remote_block_object_http_client(),\n        })","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/b9d4d170da3a31c9ace5f963d633b326348e0d42/crates/client/src/client.rs#L441-L477","documentation":"FuelClient::with_urls builds a FailoverTransport from the given URL slice and rejects an empty list immediately with 'Failed to create FuelClient. No URL is provided.' (crates/client/src/client.rs:459). This is a fail-fast guard before any network activity. Unlike single-URL constructors such as FuelClient::from, with_urls requires at least one endpoint to construct the failover chain.","triggerScenarios":"FuelClient::with_urls(&urls) where urls is empty — typically a Vec built from an env var or comma-separated config string that produced zero entries.","commonSituations":"Empty or unset NODE_URL/FUEL_NODE_URL env var; config parsing that yields an empty list; defaulting logic returning vec![] instead of a default endpoint; test setup that forgets to inject the URL.","solutions":["Pass at least one URL, e.g. FuelClient::with_urls(&[\"http://localhost:4000\"]).","Guard configuration loading with an explicit check and a clear message naming the missing setting.","For a single endpoint, prefer FuelClient::from(\"localhost:4000\"), which also normalizes the scheme."],"exampleFix":"// before\nlet urls: Vec<String> = std::env::var(\"NODE_URLS\")?.split(',').map(str::to_string).collect();\nlet client = FuelClient::with_urls(&urls)?; // empty env → error\n\n// after\nlet urls: Vec<String> = std::env::var(\"NODE_URLS\")?\n    .split(',')\n    .map(str::trim)\n    .filter(|s| !s.is_empty())\n    .map(str::to_string)\n    .collect();\nanyhow::ensure!(!urls.is_empty(), \"NODE_URLS must contain at least one Fuel node URL\");\nlet client = FuelClient::with_urls(&urls)?;","handlingStrategy":"validation","validationCode":"let urls: Vec<String> = raw.split(',').map(str::trim).filter(|s| !s.is_empty()).map(str::to_string).collect();\nanyhow::ensure!(!urls.is_empty(), \"at least one Fuel node URL is required (check NODE_URLS)\");\nlet client = FuelClient::with_urls(&urls)?;","typeGuard":"fn has_fuel_urls(urls: &[impl AsRef<str>]) -> bool {\n    urls.iter().any(|u| !u.as_ref().trim().is_empty())\n}","tryCatchPattern":null,"preventionTips":["Validate URL lists at config load with a message naming the env var or setting.","Default to a known endpoint (e.g. http://localhost:4000) in dev instead of an empty vec.","For single endpoints prefer FuelClient::from, which normalizes scheme and host."],"tags":["rust","fuel-client","configuration","url","initialization"],"backgroundTag":null,"analyzedSha":"b9d4d170da3a31c9ace5f963d633b326348e0d42","analyzedAt":"2026-08-16T08:56:42.692Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}