{"record":{"id":"51e37b73e4e104d2","repo":"dbt-labs/dbt-core","slug":"invalid-serialized-timestamp-precision","errorCode":null,"errorMessage":"invalid serialized timestamp precision","messagePattern":"invalid serialized timestamp precision","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/sql_types.rs","lineNumber":1085,"sourceCode":"                        .expect(\"string prefix checked\")\n                        .parse::<u8>()\n                        .expect(\"invalid serialized time precision\"),\n                ))\n            }\n            _ => IsTimestamp::No,\n        }\n    }\n\n    pub fn is_timestamp_ntz(data_type: &DataType) -> IsTimestamp {\n        match data_type {\n            DataType::FixedSizeList(field, 1) if field.name().starts_with(\"timestamp_ntz:\") => {\n                IsTimestamp::Yes(TimePrecision::new(\n                    field\n                        .name()\n                        .strip_prefix(\"timestamp_ntz:\")\n                        .expect(\"string prefix checked\")\n                        .parse::<u8>()\n                        .expect(\"invalid serialized timestamp precision\"),\n                ))\n            }\n            _ => IsTimestamp::No,\n        }\n    }\n\n    pub fn is_timestamp_ltz(data_type: &DataType) -> IsTimestamp {\n        match data_type {\n            DataType::FixedSizeList(field, 1) if field.name().starts_with(\"timestamp_ltz:\") => {\n                IsTimestamp::Yes(TimePrecision::new(\n                    field\n                        .name()\n                        .strip_prefix(\"timestamp_ltz:\")\n                        .expect(\"string prefix checked\")\n                        .parse::<u8>()\n                        .expect(\"invalid serialized timestamp precision\"),\n                ))\n            }","sourceCodeStart":1067,"sourceCodeEnd":1103,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/sql_types.rs#L1067-L1103","documentation":"Panic from `parse::<u8>().expect(\"invalid serialized timestamp precision\")` in `is_timestamp_ntz`. Field names encoded as `timestamp_ntz:<u8>` must carry a numeric precision suffix that fits u8 and TimePrecision's constraints; a non-numeric, empty, or out-of-range suffix makes the parse fail and panics.","triggerScenarios":"Calling `is_timestamp_ntz` with a FixedSizeList(1) whose field name is like `timestamp_ntz:abc`, `timestamp_ntz:`, `timestamp_ntz:256`, or `timestamp_ntz:3.0` — i.e. malformed serialized NTZ timestamp metadata.","commonSituations":"Corrupted or hand-edited Arrow schema fixtures, recordings produced by a mismatched dbt/adapter version, typo when constructing synthetic schemas for Snowflake NTZ columns in tests.","solutions":["Correct the field name to a valid precision (e.g. `timestamp_ntz:6` for microseconds) at the serialization site.","Regenerate stale recordings/fixtures with the current serializer rather than editing field names manually.","Check for version drift between the component that wrote the schema and the one reading it; align the encoding format.","Harden the reader: map parse failure to a proper error or IsTimestamp::No with a log instead of panicking."],"exampleFix":"// before\n.parse::<u8>()\n.expect(\"invalid serialized timestamp precision\"),\n// after\n.parse::<u8>().map_err(|_| panic!(\n    \"invalid serialized timestamp precision in '{}'\", field.name())).unwrap(),","handlingStrategy":"validation","validationCode":"fn validate_ntz_precision(name: &str) -> Result<u8, String> {\n    name.strip_prefix(\"timestamp_ntz:\")\n        .ok_or_else(|| format!(\"not an ntz field: {name}\"))?\n        .parse::<u8>()\n        .map_err(|e| format!(\"bad ntz precision in '{name}': {e}\"))\n}","typeGuard":"fn well_formed_ntz_type(dt: &DataType) -> bool {\n    matches!(dt, DataType::FixedSizeList(f, 1)\n        if f.name().strip_prefix(\"timestamp_ntz:\").is_some_and(|s| s.parse::<u8>().is_ok()))\n}","tryCatchPattern":"let checked = std::panic::catch_unwind(|| is_timestamp_ntz(&data_type));\nmatch checked {\n    Ok(ts) => use_timestamp(ts),\n    Err(_) => log::error!(\"malformed timestamp_ntz field name in schema\"),\n}","preventionTips":["Lint fixtures for `timestamp_ntz:` names whose suffix is not a valid u8.","Validate schemas at deserialization time (Arrow IPC readers) before they reach type mapping.","Keep the precision encoding documented and shared between writer and reader code paths."],"tags":["rust","panic","parse-error","arrow","serialization"],"backgroundTag":"invalid-argument-format","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}