{"record":{"id":"45ff21aa543cbf8c","repo":"SeaQL/sea-orm","slug":"failed-to-get-double","errorCode":null,"errorMessage":"Failed to get double","messagePattern":"Failed to get double","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sea-orm-sync/src/driver/sqlx_mysql.rs","lineNumber":425,"sourceCode":"                        \"TINYINT\" => Value::TinyInt(\n                            row.try_get(c.ordinal())\n                                .expect(\"Failed to get tiny integer\"),\n                        ),\n                        \"SMALLINT\" => Value::SmallInt(\n                            row.try_get(c.ordinal())\n                                .expect(\"Failed to get small integer\"),\n                        ),\n                        \"INT\" => {\n                            Value::Int(row.try_get(c.ordinal()).expect(\"Failed to get integer\"))\n                        }\n                        \"MEDIUMINT\" | \"BIGINT\" => Value::BigInt(\n                            row.try_get(c.ordinal()).expect(\"Failed to get big integer\"),\n                        ),\n                        \"FLOAT\" => {\n                            Value::Float(row.try_get(c.ordinal()).expect(\"Failed to get float\"))\n                        }\n                        \"DOUBLE\" => {\n                            Value::Double(row.try_get(c.ordinal()).expect(\"Failed to get double\"))\n                        }\n\n                        \"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\")]","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/sea-orm-sync/src/driver/sqlx_mysql.rs#L407-L443","documentation":"This panic comes from `.expect(\"Failed to get double\")` in `ProxyRow`'s MySQL driver conversion. It fires when `sqlx::Row::try_get` cannot decode the column at `c.ordinal()` into `Option<f64>` for a column whose declared type string is \"DOUBLE\". Since the conversion is written with `expect`, any decode failure aborts the thread with this message. It indicates the stored value or column type is not actually a decodable DOUBLE.","triggerScenarios":"Reading a MySQL column whose metadata type is \"DOUBLE\" but whose raw value fails f64 decoding — typically after schema changes, or when the column is actually DECIMAL/TEXT and was mislabeled as DOUBLE in captured metadata.","commonSituations":"Column altered from DOUBLE to DECIMAL while cached metadata still says DOUBLE; MySQL connector version mismatches; querying generated columns whose reported type differs from returned value type.","solutions":["Re-run `SHOW CREATE TABLE` and refresh the table metadata used by ProxyRow so the DOUBLE column is still DOUBLE.","Check the column is DOUBLE and not DECIMAL/FLOAT/TEXT; correct schema or mapping accordingly.","Ensure sqlx and its MySQL connector are up to date and consistent across the build.","Replace the `expect` with error propagation if you control the driver code, to get a proper DbErr instead of a panic."],"exampleFix":"// before\n\"DOUBLE\" => {\n    Value::Double(row.try_get(c.ordinal()).expect(\"Failed to get double\"))\n}\n// after\n\"DOUBLE\" => {\n    Value::Double(row.try_get::<Option<f64>, _>(c.ordinal())\n        .map_err(|e| DbErr::TryGetErr(...))? // propagate instead of panicking\n        .unwrap_or_default())\n}","handlingStrategy":"validation","validationCode":"// Confirm the column is a true DOUBLE before querying\nlet col = table_columns.iter().find(|c| c.name == \"my_col\").expect(\"column missing\");\nassert_eq!(col.type_name, \"DOUBLE\", \"column type drift detected\");","typeGuard":null,"tryCatchPattern":"// The panic comes from .expect inside the driver; guard with catch_unwind at the boundary:\nstd::panic::catch_unwind(|| proxy_row_from(&row, &columns))\n    .map_err(|_| DbErr::Custom(\"DOUBLE column decode failed\".into()))?","preventionTips":["Refresh table metadata after any schema change to DOUBLE columns.","Distinguish DECIMAL from DOUBLE in schema definitions; the driver branches differ.","Pin and align sqlx versions across your dependency tree to avoid decode behavior changes.","Test queries against production-like schemas in CI to catch type drift early."],"tags":["mysql","sqlx","type-decoding","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"}