{"record":{"id":"f0a042e662f0a062","repo":"nautechsystems/nautilus_trader","slug":"invalid-abfs-uri-cannot-extract-account-from-host","errorCode":null,"errorMessage":"Invalid ABFS URI: cannot extract account from host","messagePattern":"Invalid ABFS URI: cannot extract account from host","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/persistence/src/parquet.rs","lineNumber":896,"sourceCode":"\n    let azure_store = builder.build()?;\n    Ok((Arc::new(azure_store), path, uri.to_string()))\n}\n\n/// Creates an Azure object store from an `abfs://` URI with options.\n#[cfg(feature = \"cloud\")]\nfn create_abfs_store(\n    uri: &str,\n    storage_options: Option<AHashMap<String, String>>,\n) -> anyhow::Result<(Arc<dyn ObjectStore>, String, String)> {\n    let (url, path) = parse_url_and_path(uri)?;\n    let host = extract_host(&url, \"Invalid ABFS URI: missing host\")?;\n\n    // Extract account from host (account.dfs.core.windows.net)\n    let account = host\n        .split('.')\n        .next()\n        .ok_or_else(|| anyhow::anyhow!(\"Invalid ABFS URI: cannot extract account from host\"))?;\n\n    // Extract container from username part\n    let container = url\n        .username()\n        .split('@')\n        .next()\n        .ok_or_else(|| anyhow::anyhow!(\"Invalid ABFS URI: missing container\"))?;\n\n    let mut builder = object_store::azure::MicrosoftAzureBuilder::new()\n        .with_account(account)\n        .with_container_name(container);\n\n    // Apply storage options if provided (same as Azure store)\n    if let Some(options) = storage_options {\n        for (key, value) in options {\n            match key.as_str() {\n                \"account_name\" => {\n                    builder = builder.with_account(&value);","sourceCodeStart":878,"sourceCodeEnd":914,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/persistence/src/parquet.rs#L878-L914","documentation":"When building an Azure ABFS (ADLS Gen2) object store, the account name is parsed from the URI host (the part before the first dot, e.g. 'myaccount' in myaccount.dfs.core.windows.net). If the host splits in a way that yields no first segment, the parser throws this error. In practice this indicates a malformed ABFS URI host.","triggerScenarios":"Calling create_object_store_location_from_path with an abfs:// or abfss:// URI whose host is empty or does not follow account.dfs.core.windows.net format.","commonSituations":"Typos like 'abfs:///container/path' (no host); custom on-prem endpoint hosts; URI built programmatically with a missing account.","solutions":["Use full ABFS URI format: abfs[s]://<container>@<account>.dfs.core.windows.net/<path>","Verify the host portion is present and non-empty in the URI string","Print/log the parsed url.host_str() before calling to debug what the URL crate sees","Escape or percent-encode special characters in account/container names"],"exampleFix":"// before\nlet path = \"abfs:///data/file.parquet\"; // missing host\n// after\nlet path = \"abfs://container@myaccount.dfs.core.windows.net/data/file.parquet\";","handlingStrategy":"validation","validationCode":"let url = url::Url::parse(path)?;\nanyhow::ensure!(url.host_str().map_or(false, |h| h.contains('.') && !h.starts_with('.')),\n    \"ABFS URI host must be <account>.dfs.core.windows.net, got {:?}\", url.host_str());","typeGuard":"fn is_valid_abfs_uri(s: &str) -> bool {\n    url::Url::parse(s).ok()\n        .and_then(|u| u.host_str().map(|h| h.to_string()))\n        .map_or(false, |h| h.split('.').next().map_or(false, |a| !a.is_empty()))\n}","tryCatchPattern":"match create_object_store_location_from_path(path, None) {\n    Ok(loc) => loc,\n    Err(e) => return Err(e.context(format!(\"check ABFS URI format: {path}\"))),\n}","preventionTips":["Always use the full form abfs[s]://container@account.dfs.core.windows.net/path","Store the account in config and build URIs programmatically rather than hand-typing","Validate URIs in a startup config check"],"tags":["azure","abfs","url","config"],"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-14T11:17:12.474Z"}