{"record":{"id":"9a9ee31990208acc","repo":"SeaQL/sea-orm","slug":"failed-to-get-big-integer-9a9ee3","errorCode":null,"errorMessage":"Failed to get big integer","messagePattern":"Failed to get big integer","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/driver/sqlx_sqlite.rs","lineNumber":432,"sourceCode":"    use sqlx::{Column, Row, TypeInfo};\n    crate::ProxyRow {\n        values: row\n            .columns()\n            .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","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/src/driver/sqlx_sqlite.rs#L414-L450","documentation":"Proxy-row conversion maps \"BIGINT\"/\"INT8\" columns with row.try_get::<i64>(ordinal) and unwraps with expect(\"Failed to get big integer\"). It panics when the value is NULL or otherwise not decodable as i64. This arm is chosen purely from the declared column type, not the actual stored value.","triggerScenarios":"Reading a BIGINT/INT8 column through the proxy driver whose cell is NULL, or whose stored value is text/real that sqlx refuses to decode into i64.","commonSituations":"NULL timestamps-as-epoch columns; values inserted as strings by external scripts; joins producing NULL bigint columns.","solutions":["Coalesce NULLs in the query: IFNULL(col, 0)","Add NOT NULL/default constraints to BIGINT columns","Sanitize data written by external tools so types match declarations","Avoid the proxy feature so decode failures surface as DbErr"],"exampleFix":"// before\nSELECT created_at_epoch FROM events; -- NULL panics\n// after\nSELECT IFNULL(created_at_epoch, 0) AS created_at_epoch FROM events;","handlingStrategy":"try-catch","validationCode":"// Reject NULL bigint cells before querying:\n// SELECT IFNULL(big_col, 0) AS big_col FROM t;","typeGuard":"fn as_bigint(v: &sea_query::Value) -> Option<i64> {\n    match v { sea_query::Value::BigInt(i) => Some(*i), _ => None }\n}","tryCatchPattern":"let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| from_sqlx_sqlite_row_to_proxy_row(&row)));\nmatch result { Ok(r) => r, Err(_) => return Err(DbErr::Custom(\"bigint decode failed\".into())) }","preventionTips":["Add NOT NULL constraints to BIGINT columns","Fix external writers that insert text into numeric columns","Coalesce nullable bigints at the query level","Prefer the standard (non-proxy) decode path"],"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"}