nautechsystems/nautilus_trader · error · anyhow::Error

Failed to create stream conversion batch: {e}

Error message

Failed to create stream conversion batch: {e}

What it means

Wrapper in apply_stream_conversion_transforms: constructing a stream-conversion record batch failed, e.g. the schema lacks a ts_event or ts_init column needed to align timestamps when use_ts_event_for_ts_init is set; the underlying error is embedded in the message.

Source

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

            Arc::new(schema.as_ref().clone().with_metadata(metadata))
        } else {
            schema
        };

        if use_ts_event_for_ts_init {
            let ts_event_idx = schema
                .index_of("ts_event")
                .map_err(|_| anyhow::anyhow!("ts_event column not found"))?;
            let ts_init_idx = schema
                .index_of("ts_init")
                .map_err(|_| anyhow::anyhow!("ts_init column not found"))?;

            for batch in &mut batches {
                let mut columns = batch.columns().to_vec();
                columns[ts_init_idx] = columns[ts_event_idx].clone();

                *batch = RecordBatch::try_new(schema.clone(), columns).map_err(|e| {
                    anyhow::anyhow!("Failed to create stream conversion batch: {e}")
                })?;
            }
        } else if metadata_changed {
            for batch in &mut batches {
                *batch = RecordBatch::try_new(schema.clone(), batch.columns().to_vec()).map_err(
                    |e| anyhow::anyhow!("Failed to create stream conversion batch: {e}"),
                )?;
            }
        }

        let mut batch = concat_batches(&schema, batches.iter())
            .map_err(|e| anyhow::anyhow!("Failed to concatenate stream batches: {e}"))?;

        if batch.num_rows() == 0 {
            return Ok(None);
        }

        if !Self::is_record_batch_monotonic_by_ts_init(&batch)? {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Check the record batch schema contains both ts_event and ts_init columns
  2. If use_ts_event_for_ts_init is set, confirm the source data was written with those timestamp columns
  3. Re-generate the stream data from its original source so the expected schema is produced
  4. Inspect the embedded error to distinguish a schema problem from an Arrow allocation/conversion failure
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/persistence/src/backend/catalog.rs:4076 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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