nautechsystems/nautilus_trader · error · anyhow::Error
Unknown data class: {data_cls}
Error message
Unknown data class: {data_cls} What it means
During feather-to-parquet stream conversion, `convert_stream_to_data` checks the stream's data name against `is_supported_stream_data_type`. If the data class (e.g. a stream type the catalog cannot map to a known parquet writer) is unsupported, conversion bails instead of producing parquet with an unrecognizable schema. Only known stream data classes (quotes, trades, bars, deltas, etc.) can be converted.
Source
Thrown at crates/persistence/src/backend/catalog.rs:3954
// Skip unsupported stream data types without error.
if Self::is_excluded_stream_data_type(data_cls) {
return Ok(());
}
// Convert data class name to filename (e.g., "quotes" -> "quotes")
// The data_cls should already be in the correct format (snake_case)
let data_name = to_snake_case(data_cls);
// List all feather files for this data class
let feather_files =
self.list_feather_files(subdirectory, instance_id, &data_name, identifiers)?;
if feather_files.is_empty() {
return Ok(());
}
if !Self::is_supported_stream_data_type(&data_name) {
anyhow::bail!("Unknown data class: {data_cls}");
}
// Process each feather file independently so that each file's identifier
// (instrument_id or bar_type from schema metadata) is preserved when writing
// to parquet. This matches the Python _convert_feather_table_to_parquet approach.
for file_path in feather_files {
let batches = self.read_feather_file(&file_path)?;
self.convert_feather_batches_to_parquet(
&data_name,
&file_path,
batches,
use_ts_event_for_ts_init,
)?;
}
Ok(())
}
View on GitHub (pinned to 18893faf8b)
Solutions
- Check the stream's data name against the supported types enforced by `is_supported_stream_data_type` and only convert supported streams.
- Exclude or manually migrate the unsupported stream directories instead of running bulk conversion.
- If the type should be supported, extend the conversion logic (or upgrade to a library version that supports the data class).
Defensive patterns
Strategy: try-catch
Validate before calling
// Only convert streams whose data name is in the supported set
if !supported_stream_data_types().contains(data_name) {
eprintln!("skipping unsupported stream: {data_name}");
return Ok(());
} Try / catch
match catalog.convert_stream_to_data(stream_id, data_cls, &files) {
Err(e) if e.to_string().starts_with("Unknown data class") => {
log::warn!("skipping unsupported stream data: {e}");
}
Err(e) => return Err(e),
Ok(()) => {}
} Prevention
- List stream directories and check each data name against the supported set before running bulk migration.
- Keep custom data types out of directories targeted by the automatic converter.
- After a library upgrade, re-scan legacy catalogs for data types added/renamed between versions.
When it happens
Trigger: Calling `convert_stream_to_data` for a stream directory whose data name is not one of the supported stream data types — e.g. custom/unknown record types written to the feather catalog, or a typo'd data_cls identifier in the stream metadata.
Common situations: Migrating legacy feather catalogs that contain stream types added after this converter was written; custom Nautilus stream data not in the supported set; renamed data types between versions leaving old directories with stale names.
Related errors
- Unsupported data type: {type_name}
- Failed to concatenate stream batches: {e}
- Failed to reorder stream conversion batch: {e}
- Invalid config type for AxExecutionClientFactory. Expected A
- Instrument not found in cache: {symbol}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/59cb0cadc83459f7.
Report an issue: GitHub.