{"record":{"id":"e9a24bf6fc7cd1a6","repo":"nautechsystems/nautilus_trader","slug":"failed-to-parse-funding-rate-record-e","errorCode":null,"errorMessage":"Failed to parse funding rate record: {e}","messagePattern":"Failed to parse funding rate record: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/tardis/src/csv/stream.rs","lineNumber":1727,"sourceCode":"\n                    match result {\n                        Ok(Some(funding_rate)) => {\n                            self.buffer.push(funding_rate);\n                            records_read += 1;\n                            self.records_processed += 1;\n\n                            if let Some(limit) = self.limit\n                                && self.records_processed >= limit\n                            {\n                                break;\n                            }\n                        }\n                        Ok(None) => {\n                            // Skip this record as it has no funding data\n                            self.records_processed += 1;\n                        }\n                        Err(e) => {\n                            return Some(Err(anyhow::anyhow!(\n                                \"Failed to parse funding rate record: {e}\"\n                            )));\n                        }\n                    }\n                }\n                Ok(false) => {\n                    if self.buffer.is_empty() {\n                        return None;\n                    }\n                    let chunk = self.buffer.split_off(0);\n                    return Some(Ok(chunk));\n                }\n                Err(e) => return Some(Err(anyhow::anyhow!(\"Failed to read record: {e}\"))),\n            }\n        }\n\n        if self.buffer.is_empty() {\n            None","sourceCodeStart":1709,"sourceCodeEnd":1745,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/tardis/src/csv/stream.rs#L1709-L1745","documentation":"The Tardis CSV funding-rate stream parser wraps any per-record parse failure from the CSV reader into an anyhow error so the stream yields a typed error item. The underlying CSV record did not match the expected funding-rate schema (missing/malformed columns, bad types). The original reader error is preserved in `{e}`.","triggerScenarios":"Streaming a Tardis CSV funding rate file whose rows deviate from the expected schema: wrong column count, non-numeric funding rate/timestamp fields, malformed or missing values in a record.","commonSituations":"Downloading funding rate CSVs for an exchange whose Tardis schema changed; truncated or corrupted download; hand-edited files; requesting data from an instrument type the parser doesn't expect.","solutions":["Re-download the CSV from Tardis to rule out truncation/corruption.","Inspect the message's inner `{e}` to find the offending column and compare the row against the expected funding-rate header schema.","Check whether the Tardis CSV schema for the exchange changed and update the adapter/parser accordingly.","Skip or quarantine the offending file and continue with valid data if only one record set is bad."],"exampleFix":"// before: error is opaque upstream\nreturn Some(Err(anyhow::anyhow!(\"Failed to parse funding rate record: {e}\")));\n// after: include row context for diagnosability\nreturn Some(Err(anyhow::anyhow!(\n    \"Failed to parse funding rate record at line {}: {e}\",\n    self.records_processed + 1\n)));","handlingStrategy":"validation","validationCode":"// Validate header and row shape before streaming\nlet headers = reader.headers()?.clone();\nassert!(headers.contains(\"funding_rate\"), \"unexpected funding CSV schema: {:?}\", headers);","typeGuard":null,"tryCatchPattern":"match stream.next() {\n    Some(Ok(chunk)) => process(chunk),\n    Some(Err(e)) if e.to_string().contains(\"Failed to parse funding rate record\") => {\n        log::warn!(\"skipping bad funding CSV: {e}\");\n    }\n    Some(Err(e)) => return Err(e),\n    None => break,\n}","preventionTips":["Re-download CSVs rather than reusing partially-written files.","Assert the CSV header matches the expected schema before parsing.","Pin the Tardis adapter version and watch for schema-change releases."],"tags":["csv","parsing","data-ingestion"],"backgroundTag":"schema-validation-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}