{"record":{"id":"6209190556bf3ec7","repo":"SeaQL/sea-orm","slug":"failed-to-get-timestamp","errorCode":null,"errorMessage":"Failed to get timestamp","messagePattern":"Failed to get timestamp","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sea-orm-sync/src/driver/sqlx_mysql.rs","lineNumber":446,"sourceCode":"                        \"BIT\" | \"BINARY\" | \"VARBINARY\" | \"TINYBLOB\" | \"BLOB\" | \"MEDIUMBLOB\"\n                        | \"LONGBLOB\" => Value::Bytes(\n                            row.try_get::<Option<Vec<u8>>, _>(c.ordinal())\n                                .expect(\"Failed to get bytes\")\n                                .map(Box::new),\n                        ),\n\n                        \"CHAR\" | \"VARCHAR\" | \"TINYTEXT\" | \"TEXT\" | \"MEDIUMTEXT\" | \"LONGTEXT\" => {\n                            Value::String(\n                                row.try_get::<Option<String>, _>(c.ordinal())\n                                    .expect(\"Failed to get string\")\n                                    .map(Box::new),\n                            )\n                        }\n\n                        #[cfg(feature = \"with-chrono\")]\n                        \"TIMESTAMP\" => Value::ChronoDateTimeUtc(\n                            row.try_get::<Option<chrono::DateTime<chrono::Utc>>, _>(c.ordinal())\n                                .expect(\"Failed to get timestamp\")\n                                .map(Box::new),\n                        ),\n                        #[cfg(all(feature = \"with-time\", not(feature = \"with-chrono\")))]\n                        \"TIMESTAMP\" => Value::TimeDateTime(\n                            row.try_get::<Option<time::PrimitiveDateTime>, _>(c.ordinal())\n                                .expect(\"Failed to get timestamp\")\n                                .map(Box::new),\n                        ),\n\n                        #[cfg(feature = \"with-chrono\")]\n                        \"DATE\" => Value::ChronoDate(\n                            row.try_get::<Option<chrono::NaiveDate>, _>(c.ordinal())\n                                .expect(\"Failed to get date\")\n                                .map(Box::new),\n                        ),\n                        #[cfg(all(feature = \"with-time\", not(feature = \"with-chrono\")))]\n                        \"DATE\" => Value::TimeDate(\n                            row.try_get::<Option<time::Date>, _>(c.ordinal())","sourceCodeStart":428,"sourceCodeEnd":464,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/sea-orm-sync/src/driver/sqlx_mysql.rs#L428-L464","documentation":"This panic comes from the `with-chrono` TIMESTAMP branch of `ProxyRow` in the MySQL driver: `sqlx::Row::try_get::<Option<chrono::DateTime<chrono::Utc>>, _>` failed for a column whose declared type is \"TIMESTAMP\". The `expect` turns the decode error into a panic with \"Failed to get timestamp\". It indicates the stored value cannot be decoded into a chrono UTC DateTime under the active feature configuration, often due to feature-flag or schema mismatch.","triggerScenarios":"Reading a MySQL TIMESTAMP column while the crate is compiled with `with-chrono`, but the value cannot be decoded as `chrono::DateTime<Utc>` — e.g. metadata mismatch (column actually DATETIME/VARCHAR), or the crate was built with conflicting feature flags so the wrong branch matched.","commonSituations":"Mixing feature flags (`with-chrono` vs `with-time`) across crate versions; column altered from TIMESTAMP to another type while stale metadata is used; zero dates ('0000-00-00') in MySQL that chrono cannot decode.","solutions":["Confirm the live column type is TIMESTAMP and refresh metadata if it changed.","Verify feature flags are consistent: `with-chrono` vs `with-time` must not conflict across your dependency tree.","Fix or exclude MySQL zero-dates ('0000-00-00 00:00:00'), which chrono cannot decode.","Patch the driver to propagate DbErr instead of panicking to surface the underlying sqlx decode error."],"exampleFix":"// before\n\"TIMESTAMP\" => Value::ChronoDateTimeUtc(\n    row.try_get::<Option<chrono::DateTime<chrono::Utc>>, _>(c.ordinal())\n        .expect(\"Failed to get timestamp\")\n        .map(Box::new),\n)\n// after\n\"TIMESTAMP\" => Value::ChronoDateTimeUtc(\n    row.try_get::<Option<chrono::DateTime<chrono::Utc>>, _>(c.ordinal())\n        .map_err(|e| DbErr::TryGetErr(...))? // propagate instead of panicking\n        .map(Box::new),\n)","handlingStrategy":"validation","validationCode":"// Check the column is TIMESTAMP and contains no zero-dates before querying\nassert_eq!(col.type_name, \"TIMESTAMP\");\n// detect zero-dates:\n// SELECT COUNT(*) FROM t WHERE ts = '0000-00-00 00:00:00'; must be 0","typeGuard":null,"tryCatchPattern":"// Guard the panic boundary since the driver uses expect:\nstd::panic::catch_unwind(|| proxy_row_from(&row, &columns))\n    .map_err(|_| DbErr::Custom(\"TIMESTAMP column decode failed\".into()))?","preventionTips":["Keep `with-chrono` feature flags consistent across all crates in your dependency tree.","Eliminate MySQL zero-dates by setting sql_mode to include NO_ZERO_DATE.","Refresh table metadata after schema changes to TIMESTAMP columns.","Match TIMESTAMP to ChronoDateTimeUtc mappings when using chrono features."],"tags":["mysql","sqlx","chrono","timestamp","panic"],"backgroundTag":"type-mismatch","analyzedSha":"e29bcd1b417c41a553b386fe94511d7c64a1c8ec","analyzedAt":"2026-09-10T11:31:52.468Z","contentChangedAt":"2026-09-10T11:31:52.468Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}