{"record":{"id":"fe94d5947bec8a0e","repo":"SeaQL/sea-orm","slug":"failed-to-get-time","errorCode":null,"errorMessage":"Failed to get time","messagePattern":"Failed to get time","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sea-orm-sync/src/driver/sqlx_mysql.rs","lineNumber":472,"sourceCode":"                        ),\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())\n                                .expect(\"Failed to get date\")\n                                .map(Box::new),\n                        ),\n\n                        #[cfg(feature = \"with-chrono\")]\n                        \"TIME\" => Value::ChronoTime(\n                            row.try_get::<Option<chrono::NaiveTime>, _>(c.ordinal())\n                                .expect(\"Failed to get time\")\n                                .map(Box::new),\n                        ),\n                        #[cfg(all(feature = \"with-time\", not(feature = \"with-chrono\")))]\n                        \"TIME\" => Value::TimeTime(\n                            row.try_get::<Option<time::Time>, _>(c.ordinal())\n                                .expect(\"Failed to get time\")\n                                .map(Box::new),\n                        ),\n\n                        #[cfg(feature = \"with-chrono\")]\n                        \"DATETIME\" => Value::ChronoDateTime(\n                            row.try_get::<Option<chrono::NaiveDateTime>, _>(c.ordinal())\n                                .expect(\"Failed to get datetime\")\n                                .map(Box::new),\n                        ),\n                        #[cfg(all(feature = \"with-time\", not(feature = \"with-chrono\")))]\n                        \"DATETIME\" => Value::TimeDateTime(\n                            row.try_get::<Option<time::PrimitiveDateTime>, _>(c.ordinal())","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/sea-orm-sync/src/driver/sqlx_mysql.rs#L454-L490","documentation":"This panic comes from the `with-chrono` TIME branch of `ProxyRow` in the MySQL driver: `sqlx::Row::try_get::<Option<chrono::NaiveTime>, _>` failed for a \"TIME\" column at `c.ordinal()`. The `expect` turns the sqlx decode error into a panic with \"Failed to get time\". It means the stored value cannot be decoded as a `chrono::NaiveTime`, typically because the column's live type differs from the captured metadata or the value is malformed.","triggerScenarios":"Reading a MySQL TIME column while compiled with `with-chrono`, when the raw value is not decodable as `chrono::NaiveTime` — e.g. the column was altered to VARCHAR/DATETIME, or contains invalid time strings.","commonSituations":"MySQL TIME values out of chrono's supported range (MySQL allows large hour values like '850:00:00'); stale metadata after ALTER TABLE; feature-flag mismatches between chrono and time.","solutions":["Check for MySQL TIME values exceeding chrono's range (e.g. '850:00:00') and normalize them.","Refresh the captured table metadata so TIME mapping matches the live column type.","Verify the column is genuinely TIME; correct the schema or the driver's type mapping if not.","Patch the driver to propagate DbErr instead of panicking, revealing the underlying sqlx error."],"exampleFix":"// before\n\"TIME\" => Value::ChronoTime(\n    row.try_get::<Option<chrono::NaiveTime>, _>(c.ordinal())\n        .expect(\"Failed to get time\")\n        .map(Box::new),\n)\n// after\n\"TIME\" => Value::ChronoTime(\n    row.try_get::<Option<chrono::NaiveTime>, _>(c.ordinal())\n        .map_err(|e| DbErr::TryGetErr(...))? // propagate instead of panicking\n        .map(Box::new),\n)","handlingStrategy":"validation","validationCode":"// MySQL TIME can exceed 24h (e.g. '850:00:00') which chrono cannot decode; detect first:\n// SELECT COUNT(*) FROM t WHERE time_col > '23:59:59'; must be 0 or handled\nassert_eq!(col.type_name, \"TIME\");","typeGuard":null,"tryCatchPattern":"// The driver panics via .expect; wrap the boundary:\nstd::panic::catch_unwind(|| proxy_row_from(&row, &columns))\n    .map_err(|_| DbErr::Custom(\"TIME column decode failed\".into()))?","preventionTips":["Normalize MySQL TIME values to <= 23:59:59 if your decoder does not support extended ranges.","Refresh metadata after schema changes to TIME columns.","Keep `with-chrono` feature usage consistent across the dependency tree.","Scan legacy data for out-of-range TIME values before enabling this driver path."],"tags":["mysql","sqlx","chrono","time","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"}