{"record":{"id":"0e05847cb6297075","repo":"SeaQL/sea-orm","slug":"failed-to-get-big-integer-0e0584","errorCode":null,"errorMessage":"Failed to get big integer","messagePattern":"Failed to get big integer","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sea-orm-sync/src/driver/sqlx_sqlite.rs","lineNumber":423,"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":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/sea-orm-sync/src/driver/sqlx_sqlite.rs#L405-L441","documentation":"Panic when sea-orm-sync's SQLite driver cannot decode a \"BIGINT\"/\"INT8\" column into i64 while building a ProxyRow. This fires when the value under a BIGINT-typed column cannot actually be read as a 64-bit integer — typically NULL, or a value stored as text/real due to SQLite's dynamic typing.","triggerScenarios":"Reading a BIGINT or INT8 declared column whose stored value is NULL decoded into a non-Option i64, or whose underlying storage class is TEXT/REAL (SQLite type affinity does not enforce storage type).","commonSituations":"Rows inserted via raw SQL or another tool storing '123' as text in a BIGINT column; NULLs in legacy data; mixed-type columns after importing from CSV.","solutions":["Run SELECT typeof(col) ... to find rows whose storage class is not integer and fix them (UPDATE ... SET col = CAST(col AS INTEGER))","Decode as Option<i64> and handle NULL explicitly instead of non-Option try_get","Recreate the column with NOT NULL and proper affinity to enforce integer storage","Propagate the sqlx error with column context instead of .expect"],"exampleFix":"// before\n\"BIGINT\" | \"INT8\" => Value::BigInt(\n    row.try_get(c.ordinal()).expect(\"Failed to get big integer\"),\n),\n// after\n\"BIGINT\" | \"INT8\" => Value::BigInt(\n    row.try_get::<Option<i64>, _>(c.ordinal())\n        .expect(\"Failed to get big integer\")\n        .unwrap_or(0),\n)   // better: propagate the error with the column name","handlingStrategy":"validation","validationCode":"// Verify BIGINT columns hold true integers:\n// SELECT typeof(col), count(*) FROM t GROUP BY typeof(col);","typeGuard":"fn is_integer_storage(type_of: &str) -> bool { type_of == \"integer\" }","tryCatchPattern":"let row = std::panic::catch_unwind(|| proxy_query(db)).unwrap_or_else(|_| fallback_row());","preventionTips":["CAST text/real values to INTEGER after imports","Insert through typed entity fields (i64) rather than raw SQL","Add NOT NULL DEFAULT 0 to bigint columns","Run typeof() audits on legacy tables"],"tags":["rust","sqlx","sqlite","bigint","type-conversion","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-14T11:17:12.474Z"}