{"record":{"id":"8e94a51eaa4b5758","repo":"SeaQL/sea-orm","slug":"failed-to-get-double-8e94a5","errorCode":null,"errorMessage":"Failed to get double","messagePattern":"Failed to get double","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/driver/sqlx_sqlite.rs","lineNumber":436,"sourceCode":"            .iter()\n            .map(|c| {\n                (\n                    c.name().to_string(),\n                    match c.type_info().name() {\n                        \"BOOLEAN\" => {\n                            Value::Bool(row.try_get(c.ordinal()).expect(\"Failed to get boolean\"))\n                        }\n\n                        \"INTEGER\" => {\n                            Value::Int(row.try_get(c.ordinal()).expect(\"Failed to get integer\"))\n                        }\n\n                        \"BIGINT\" | \"INT8\" => Value::BigInt(\n                            row.try_get(c.ordinal()).expect(\"Failed to get big integer\"),\n                        ),\n\n                        \"REAL\" => {\n                            Value::Double(row.try_get(c.ordinal()).expect(\"Failed to get double\"))\n                        }\n\n                        \"TEXT\" => Value::String(\n                            row.try_get::<Option<String>, _>(c.ordinal())\n                                .expect(\"Failed to get string\")\n                                .map(Box::new),\n                        ),\n\n                        \"BLOB\" => Value::Bytes(\n                            row.try_get::<Option<Vec<u8>>, _>(c.ordinal())\n                                .expect(\"Failed to get bytes\")\n                                .map(Box::new),\n                        ),\n\n                        #[cfg(feature = \"with-chrono\")]\n                        \"DATETIME\" => {\n                            use chrono::{DateTime, Utc};\n","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/src/driver/sqlx_sqlite.rs#L418-L454","documentation":"Proxy-row conversion maps \"REAL\" columns with row.try_get::<f64>(ordinal) and unwraps with expect(\"Failed to get double\"). It panics when the stored value is NULL or not decodable as f64. The branch is selected from the declared type info, so SQLite dynamic typing can still hand back a mismatched value.","triggerScenarios":"Querying a REAL/FLOAT/DOUBLE-declared column containing NULL or an integer/text value via the proxy driver.","commonSituations":"Float columns populated with NULL by partial inserts; text values written by import scripts; expressions like SUM over empty sets returning NULL.","solutions":["Coalesce NULLs: SELECT IFNULL(price, 0.0) AS price ...","Declare float columns NOT NULL with a default","Fix import tooling to write numeric types","Use a non-proxy driver so failures become DbErr instead of panics"],"exampleFix":"// before\nSELECT AVG(score) AS score FROM results; -- NULL on empty set\n// after\nSELECT IFNULL(AVG(score), 0.0) AS score FROM results;","handlingStrategy":"try-catch","validationCode":"// Coalesce nullable floats in SQL before proxy conversion:\n// SELECT IFNULL(score, 0.0) AS score FROM results;","typeGuard":"fn as_f64(v: &sea_query::Value) -> Option<f64> {\n    match v { sea_query::Value::Double(d) => Some(*d), sea_query::Value::Float(f) => Some(*f as f64), _ => None }\n}","tryCatchPattern":"let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| from_sqlx_sqlite_row_to_proxy_row(&row)));\nif result.is_err() { /* fall back to manual decode with defaults */ }","preventionTips":["Default REAL columns to 0.0 rather than NULL","Guard aggregates (AVG/SUM) with IFNULL","Validate imported data types before inserting","Avoid raw SQL with untyped expressions feeding the proxy"],"tags":["sqlite","sqlx","proxy","null-value","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"}