SeaQL/sea-orm · error
Failed to get big integer
Error message
Failed to get big integer
What it means
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.
Source
Thrown at sea-orm-sync/src/driver/sqlx_sqlite.rs:423
use sqlx::{Column, Row, TypeInfo};
crate::ProxyRow {
values: row
.columns()
.iter()
.map(|c| {
(
c.name().to_string(),
match c.type_info().name() {
"BOOLEAN" => {
Value::Bool(row.try_get(c.ordinal()).expect("Failed to get boolean"))
}
"INTEGER" => {
Value::Int(row.try_get(c.ordinal()).expect("Failed to get integer"))
}
"BIGINT" | "INT8" => Value::BigInt(
row.try_get(c.ordinal()).expect("Failed to get big integer"),
),
"REAL" => {
Value::Double(row.try_get(c.ordinal()).expect("Failed to get double"))
}
"TEXT" => Value::String(
row.try_get::<Option<String>, _>(c.ordinal())
.expect("Failed to get string")
.map(Box::new),
),
"BLOB" => Value::Bytes(
row.try_get::<Option<Vec<u8>>, _>(c.ordinal())
.expect("Failed to get bytes")
.map(Box::new),
),
View on GitHub (pinned to e29bcd1b41)
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
Example fix
// before
"BIGINT" | "INT8" => Value::BigInt(
row.try_get(c.ordinal()).expect("Failed to get big integer"),
),
// after
"BIGINT" | "INT8" => Value::BigInt(
row.try_get::<Option<i64>, _>(c.ordinal())
.expect("Failed to get big integer")
.unwrap_or(0),
) // better: propagate the error with the column name Defensive patterns
Strategy: validation
Validate before calling
// Verify BIGINT columns hold true integers: // SELECT typeof(col), count(*) FROM t GROUP BY typeof(col);
Type guard
fn is_integer_storage(type_of: &str) -> bool { type_of == "integer" } Try / catch
let row = std::panic::catch_unwind(|| proxy_query(db)).unwrap_or_else(|_| fallback_row());
Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Failed to get boolean
- Failed to get integer
- Failed to get double
- Failed to get string
- Failed to get bytes
AI-assisted analysis of SeaQL/sea-orm@e29bcd1b41 (2026-09-10).
Data as JSON: /api/errors/0e05847cb6297075.
Report an issue: GitHub.