nautechsystems/nautilus_trader · error · anyhow::Error

Unsupported data type: {type_name}

Error message

Unsupported data type: {type_name}

What it means

Raised by delete_data_range when the record's data type is not one of the built-in supported types and is also not a 'custom/<name>' type. The delete path has concrete generic implementations per known type (Quote, Trade, OrderBookDepth10, etc.) and a custom-data fallback; anything else cannot be dispatched.

Source

Thrown at crates/persistence/src/backend/catalog_operations.rs:1821

        start: Option<UnixNanos>,
        end: Option<UnixNanos>,
    ) -> anyhow::Result<()> {
        // Use match statement to call the generic delete_data_range for various types
        match type_name {
            "quotes" => self.delete_data_range_generic::<QuoteTick>(identifier, start, end),
            "trades" => self.delete_data_range_generic::<TradeTick>(identifier, start, end),
            "bars" => self.delete_data_range_generic::<Bar>(identifier, start, end),
            "order_book_deltas" => {
                self.delete_data_range_generic::<OrderBookDelta>(identifier, start, end)
            }
            "order_book_depth10" => {
                self.delete_data_range_generic::<OrderBookDepth10>(identifier, start, end)
            }
            _ => {
                if let Some(custom_type_name) = type_name.strip_prefix("custom/") {
                    self.delete_custom_data_range(custom_type_name, identifier, start, end)
                } else {
                    anyhow::bail!("Unsupported data type: {type_name}");
                }
            }
        }
    }

    /// Deletes data within a specified time range across the entire catalog.
    ///
    /// This method identifies all leaf directories in the catalog that contain parquet files
    /// and deletes data within the specified time range from each directory. A leaf directory
    /// is one that contains files but no subdirectories. This is a convenience method that
    /// effectively calls `delete_data_range` for all data types and instrument IDs in the catalog.
    ///
    /// # Parameters
    ///
    /// - `start`: Optional start timestamp for the deletion range. If None, deletes from the beginning.
    /// - `end`: Optional end timestamp for the deletion range. If None, deletes to the end.
    ///
    /// # Returns

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Check the exact type_name stored in the catalog (via the record/metadata) and use the canonical built-in name.
  2. For user-defined types, ensure the name is passed as 'custom/<YourType>'.
  3. Upgrade or align the NautilusTrader version so the catalog's data types are all supported by this build.
  4. If the type truly is unsupported, delete the files manually or extend delete_data_range with the needed generic arm.

Example fix

// before
if let Some(custom) = type_name.strip_prefix("CustomTick") { ... }
// after — use the custom/ prefix for user-defined types
delete_catalog_range(&identifier_with_type_name("custom/CustomTick"), start, end)?;
Defensive patterns

Strategy: type-guard

Validate before calling

fn is_deletable(type_name: &str) -> bool {
    matches!(type_name, "Quote" | "Trade" | "OrderBookDepth10" | "OrderBookDelta"
        | "Bar" | "Instrument..." ) || type_name.starts_with("custom/")
}

Type guard

fn deletable_type(type_name: &str) -> Option<&str> {
    if type_name.starts_with("custom/") || is_builtin_type(type_name) { Some(type_name) } else { None }
}

Try / catch

match catalog.delete_data_range(&identifier, start, end) {
    Err(e) if e.to_string().starts_with("Unsupported data type") => {
        eprintln!("check type_name spelling or use 'custom/<name>' prefix");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling delete_catalog_range / delete_data_range with an identifier whose type_name is neither a built-in type nor prefixed with 'custom/' — typically a typo in the type string or a type from a newer/older schema version.

Common situations: Hand-written type names like 'quotes' instead of the canonical 'Quote', reading a catalog written by a different NautilusTrader version with types this build doesn't know, or passing raw type names without the 'custom/' prefix for user-defined data.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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