nautechsystems/nautilus_trader · error · anyhow::Error

Invalid ABFS URI: missing container

Error message

Invalid ABFS URI: missing container

What it means

The ABFS store builder extracts the container name from the URI username component (the part before '@' in <container>@<account>...). If the username is missing/empty, this error is thrown because an Azure container is required to construct the store.

Source

Thrown at crates/persistence/src/parquet.rs:903

fn create_abfs_store(
    uri: &str,
    storage_options: Option<AHashMap<String, String>>,
) -> anyhow::Result<(Arc<dyn ObjectStore>, String, String)> {
    let (url, path) = parse_url_and_path(uri)?;
    let host = extract_host(&url, "Invalid ABFS URI: missing host")?;

    // Extract account from host (account.dfs.core.windows.net)
    let account = host
        .split('.')
        .next()
        .ok_or_else(|| anyhow::anyhow!("Invalid ABFS URI: cannot extract account from host"))?;

    // Extract container from username part
    let container = url
        .username()
        .split('@')
        .next()
        .ok_or_else(|| anyhow::anyhow!("Invalid ABFS URI: missing container"))?;

    let mut builder = object_store::azure::MicrosoftAzureBuilder::new()
        .with_account(account)
        .with_container_name(container);

    // Apply storage options if provided (same as Azure store)
    if let Some(options) = storage_options {
        for (key, value) in options {
            match key.as_str() {
                "account_name" => {
                    builder = builder.with_account(&value);
                }
                "account_key" => {
                    builder = builder.with_access_key(&value);
                }
                "sas_token" => {
                    // Parse SAS token as query string parameters
                    let query_pairs: Vec<(String, String)> = value

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Include the container in the URI: abfs[s]://<container>@<account>.dfs.core.windows.net/<path>
  2. Check storage options/config so the container value is set before building the URI
  3. Validate the URI shape before calling create_object_store_location_from_path
  4. Alternatively pass the container via the builder options if the code path supports it

Example fix

// before
let path = "abfss://mystorage.dfs.core.windows.net/data"; // no container@
// after
let path = "abfss://mydata@mystorage.dfs.core.windows.net/data";
Defensive patterns

Strategy: validation

Validate before calling

let url = url::Url::parse(path)?;
anyhow::ensure!(!url.username().is_empty(), "ABFS URI must include container: abfs://<container>@<account>.dfs.core.windows.net/...");

Type guard

fn has_abfs_container(s: &str) -> bool {
    url::Url::parse(s).map_or(false, |u| !u.username().is_empty())
}

Try / catch

let store = create_object_store_location_from_path(path, opts)
    .map_err(|e| anyhow::anyhow!("ABFS path '{path}' invalid: {e}"))?;

Prevention

When it happens

Trigger: Passing an abfs:// or abfss:// URI without the container@account prefix, e.g. abfss://account.dfs.core.windows.net/path.

Common situations: Copying a blob-style Azure URL (account.blob.core.windows.net) instead of the ADLS Gen2 style; building URIs from config with an unset container field.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/61faab83416fd814. Report an issue: GitHub.