nautechsystems/nautilus_trader · error

Failed to create catalog from path

Error message

Failed to create catalog from path

What it means

ParquetDataCatalog::new builds a catalog from a filesystem/URI path and unwraps the underlying construction result. Any failure initializing the catalog (path resolution, object_store backend creation, invalid options) surfaces as this panic instead of a Result.

Source

Thrown at crates/persistence/src/backend/catalog.rs:233

    /// );
    /// ```
    #[must_use]
    pub fn new(
        base_path: &Path,
        storage_options: Option<AHashMap<String, String>>,
        batch_size: Option<usize>,
        compression: Option<parquet::basic::Compression>,
        max_row_group_size: Option<usize>,
    ) -> Self {
        let path_str = base_path.to_string_lossy().to_string();
        Self::from_uri(
            &path_str,
            storage_options,
            batch_size,
            compression,
            max_row_group_size,
        )
        .expect("Failed to create catalog from path")
    }

    /// Creates a new [`ParquetDataCatalog`] instance from a URI with optional storage options.
    ///
    /// Supports various URI schemes including local file paths and multiple cloud storage backends
    /// supported by the `object_store` crate.
    ///
    /// # Supported URI Schemes
    ///
    /// - **AWS S3**: `s3://bucket/path`.
    /// - **Google Cloud Storage**: `gs://bucket/path` or `gcs://bucket/path`.
    /// - **Azure Blob Storage**: `az://container/path` or `abfs://container@account.dfs.core.windows.net/path`.
    /// - **HTTP/WebDAV**: `http://` or `https://`.
    /// - **Local files**: `file://path` or plain paths.
    ///
    /// # Parameters
    ///
    /// - `uri`: The URI for the data storage location.

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Verify the path/URI exists and is accessible before constructing the catalog.
  2. For cloud URIs, supply the correct storage_options (keys, endpoints, region).
  3. Check compression and batch_size values against supported options.
  4. Prefer a constructor returning Result (e.g. from_uri variant) to handle errors gracefully.

Example fix

// before
let catalog = ParquetDataCatalog::new(trader_id, instance_id, path, None, None, None, None);
// after
if !Path::new(path_str).exists() {
    eprintln!("catalog path missing: {path_str}");
    return;
}
let catalog = ParquetDataCatalog::new(trader_id, instance_id, path, None, None, None, None);
Defensive patterns

Strategy: validation

Validate before calling

if !Path::new(path).exists() {
    eprintln!("catalog path does not exist: {path}");
    return;
}

Type guard

fn path_accessible(p: &str) -> bool { Path::new(p).exists() }

Try / catch

let catalog = std::panic::catch_unwind(|| ParquetDataCatalog::new(/*...*/))
    .map_err(|_| anyhow::anyhow!("failed to create catalog at {path}"))?;

Prevention

When it happens

Trigger: Calling ParquetDataCatalog::new with a nonexistent or inaccessible path, an unsupported URI scheme, invalid storage_options for the backend, or incompatible batch_size/compression/max_row_group_size values.

Common situations: Typo in the data directory, missing cloud credentials/storage options for s3/gcs/azure URIs, running without the write directory existing, wrong compression setting name.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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