{"record":{"id":"1492b18944cc1bb9","repo":"nautechsystems/nautilus_trader","slug":"failed-to-create-stream-conversion-batch-e","errorCode":null,"errorMessage":"Failed to create stream conversion batch: {e}","messagePattern":"Failed to create stream conversion batch: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/persistence/src/backend/catalog.rs","lineNumber":4076,"sourceCode":"            Arc::new(schema.as_ref().clone().with_metadata(metadata))\n        } else {\n            schema\n        };\n\n        if use_ts_event_for_ts_init {\n            let ts_event_idx = schema\n                .index_of(\"ts_event\")\n                .map_err(|_| anyhow::anyhow!(\"ts_event column not found\"))?;\n            let ts_init_idx = schema\n                .index_of(\"ts_init\")\n                .map_err(|_| anyhow::anyhow!(\"ts_init column not found\"))?;\n\n            for batch in &mut batches {\n                let mut columns = batch.columns().to_vec();\n                columns[ts_init_idx] = columns[ts_event_idx].clone();\n\n                *batch = RecordBatch::try_new(schema.clone(), columns).map_err(|e| {\n                    anyhow::anyhow!(\"Failed to create stream conversion batch: {e}\")\n                })?;\n            }\n        } else if metadata_changed {\n            for batch in &mut batches {\n                *batch = RecordBatch::try_new(schema.clone(), batch.columns().to_vec()).map_err(\n                    |e| anyhow::anyhow!(\"Failed to create stream conversion batch: {e}\"),\n                )?;\n            }\n        }\n\n        let mut batch = concat_batches(&schema, batches.iter())\n            .map_err(|e| anyhow::anyhow!(\"Failed to concatenate stream batches: {e}\"))?;\n\n        if batch.num_rows() == 0 {\n            return Ok(None);\n        }\n\n        if !Self::is_record_batch_monotonic_by_ts_init(&batch)? {","sourceCodeStart":4058,"sourceCodeEnd":4094,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/persistence/src/backend/catalog.rs#L4058-L4094","documentation":"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.","triggerScenarios":"Thrown at crates/persistence/src/backend/catalog.rs:4076 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the record batch schema contains both ts_event and ts_init columns","If use_ts_event_for_ts_init is set, confirm the source data was written with those timestamp columns","Re-generate the stream data from its original source so the expected schema is produced","Inspect the embedded error to distinguish a schema problem from an Arrow allocation/conversion failure"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}