{"record":{"id":"68f6cf9117c790ab","repo":"SeaQL/sea-orm","slug":"failed-to-get-float","errorCode":null,"errorMessage":"Failed to get float","messagePattern":"Failed to get float","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sea-orm-sync/src/driver/sqlx_mysql.rs","lineNumber":422,"sourceCode":"                            row.try_get(c.ordinal())\n                                .expect(\"Failed to get unsigned big integer\"),\n                        ),\n                        \"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                            )","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/sea-orm-sync/src/driver/sqlx_mysql.rs#L404-L440","documentation":"This panic comes from an `.expect(\"Failed to get float\")` inside `ProxyRow`'s column-to-`Value` conversion in the MySQL driver. It means `sqlx::Row::try_get` failed while decoding a FLOAT column at the column's ordinal position into an `Option<f32>`. The library uses `expect` because conversion failures are considered unrecoverable during row proxying, so instead of returning a `Result` it panics with this message. Typically the column's declared type does not match the value actually stored (e.g. NULL handling or a schema drift where the column is not really a float).","triggerScenarios":"Querying a MySQL table where a column's declared type string is \"FLOAT\" but the raw value at `c.ordinal()` cannot be decoded as `Option<f32>` — e.g. schema altered after metadata was captured, incompatible column encoding, or out-of-range/stale column ordinals.","commonSituations":"Schema drift between the captured table metadata and the live database; using this driver against views or computed columns whose reported type string is FLOAT but whose returned values are not f32-decodable; mismatched driver/connector versions decoding MySQL FLOAT.","solutions":["Verify the live table schema (`SHOW CREATE TABLE`) matches the metadata used to build ProxyRow; refresh metadata if the column type changed.","Check that the column is actually MySQL FLOAT and not DECIMAL/DOUBLE or a string; adjust the schema or the query.","Confirm NULL values are acceptable — try_get decodes `Option<f32>`, so a type mismatch (not NULL) is the usual culprit.","Upgrade/align `sqlx` MySQL versions so FLOAT decoding behaves as expected, or patch the driver to fall back instead of panicking."],"exampleFix":"// before\n\"FLOAT\" => {\n    Value::Float(row.try_get(c.ordinal()).expect(\"Failed to get float\"))\n}\n// after\n\"FLOAT\" => {\n    Value::Float(row.try_get::<Option<f32>, _>(c.ordinal())\n        .map_err(|e| DbErr::TryGetErr(...))? // propagate instead of panicking\n        .unwrap_or_default())\n}","handlingStrategy":"validation","validationCode":"// Before querying, verify the column type matches expectations\nlet schema_matches = table_columns.iter().any(|c| c.name == \"my_col\" && c.type_name == \"FLOAT\");\nif !schema_matches {\n    // refresh metadata or fail fast instead of triggering the driver panic\n}","typeGuard":null,"tryCatchPattern":"// The library panics (expect), so standard try/catch does not apply.\n// Catch the unwind boundary if using this in a service:\nlet result = std::panic::catch_unwind(|| proxy_row_from(&row, &columns));\nmatch result {\n    Ok(v) => v,\n    Err(_) => return Err(DbErr::Custom(\"FLOAT column decode failed\".into())),\n}","preventionTips":["Keep captured table metadata in sync with the live schema; refresh after every ALTER TABLE.","Run schema drift checks (e.g. comparing SHOW CREATE TABLE to expected definitions) before row proxying.","Avoid MySQL zero-dates and out-of-range values by enforcing strict sql_mode.","Prefer building sea-orm-sync from source so you can replace `expect` with proper error propagation."],"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"}