nautechsystems/nautilus_trader · error · anyhow::Error
Unknown data type for consolidation: {type_name}
Error message
Unknown data type for consolidation: {type_name} What it means
`consolidate_data_by_period` dispatches on the data type name (e.g. "quotes", "trades", "bars", "custom/...") to pick the right generic consolidation routine. If the name matches none of the known built-in types and is not prefixed with `custom/`, the library bails with this error. (Note: the bail string uses `{type_name}` inline-captured by anyhow's format machinery, so the message does include the offending name.)
Source
Thrown at crates/persistence/src/backend/catalog_operations.rs:751
identifier,
period_nanos,
start,
end,
ensure_contiguous_files,
)?;
}
_ => {
if let Some(custom_type_name) = type_name.strip_prefix("custom/") {
self.consolidate_custom_data_by_period(
custom_type_name,
identifier,
period_nanos,
start,
end,
ensure_contiguous_files,
)?;
} else {
anyhow::bail!("Unknown data type for consolidation: {type_name}");
}
}
}
Ok(())
}
/// Generic consolidate data files by splitting them into fixed time periods.
///
/// This is a type-safe version of `consolidate_data_by_period` that uses generic types
/// to ensure compile-time correctness and enable reuse across different data types.
///
/// # Type Parameters
///
/// - `T`: The data type to consolidate, must implement required traits for serialization.
///
/// # Parameters
///View on GitHub (pinned to 18893faf8b)
Solutions
- Check the exact directory name under the catalog (e.g. `data/quotes.parquet/`) and pass that string verbatim as data_type.
- For custom data types, use the `custom/` prefix: pass `custom/MyCustomType` matching the registered type name.
- Fix casing/typos — names are lowercase snake_case exact matches ("bars", not "Bars").
- If the data genuinely needs support, write the files via supported types or extend the dispatch to handle the type.
Example fix
// before
catalog.consolidate_data_by_period("Bars", identifier, period_nanos, ...).await?;
// after
catalog.consolidate_data_by_period("bars", identifier, period_nanos, ...).await?; Defensive patterns
Strategy: validation
Validate before calling
const KNOWN: &[&str] = &["quotes","trades","deltas","depth10","order_book_depths","bars","index_prices","mark_prices","instrument_closes"];
if !KNOWN.contains(&data_type) && !data_type.starts_with("custom/") {
return Err(format!("unsupported data_type: {data_type}"));
} Prevention
- Copy data_type strings from the actual catalog directory names on disk.
- Remember names are lowercase snake_case; match exactly.
- Prefix custom types with `custom/` exactly as registered.
- Check the dispatch list in catalog_operations.rs when unsure which names are supported.
When it happens
Trigger: Calling `consolidate_data_by_period` (via `consolidate_data`/`consolidate_catalog`) with a `data_type` string that is neither one of the known directory names — quotes, trades, deltas, depth10/order_book_depths, bars, index_prices, mark_prices, instrument_closes, etc. — nor of the form `custom/<CustomData>`, e.g. a typo like "quote" or "Bars".
Common situations: Typo or wrong casing in the data_type argument; expecting a custom type to be consolidated without the `custom/` prefix; referring to a type name that differs from the on-disk directory name produced by the writer; version changes where a directory name was renamed.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Intervals are not contiguous. When ensure_contiguous_files=t
- height must be positive, was {self.height}
- Unknown execution event marker {event}
- No durable store configured; refusing to submit a {} transac
- Unsupported order side {}; only Buy and Sell are supported
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/907b56f73568602c.
Report an issue: GitHub.