{"record":{"id":"008da2d3c2542996","repo":"SeaQL/sea-orm","slug":"failed-to-get-unsigned-big-integer","errorCode":null,"errorMessage":"Failed to get unsigned big integer","messagePattern":"Failed to get unsigned big integer","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sea-orm-sync/src/driver/sqlx_mysql.rs","lineNumber":405,"sourceCode":"                    match c.type_info().name() {\n                        \"TINYINT(1)\" | \"BOOLEAN\" => {\n                            Value::Bool(row.try_get(c.ordinal()).expect(\"Failed to get boolean\"))\n                        }\n                        \"TINYINT UNSIGNED\" => Value::TinyUnsigned(\n                            row.try_get(c.ordinal())\n                                .expect(\"Failed to get unsigned tiny integer\"),\n                        ),\n                        \"SMALLINT UNSIGNED\" => Value::SmallUnsigned(\n                            row.try_get(c.ordinal())\n                                .expect(\"Failed to get unsigned small integer\"),\n                        ),\n                        \"INT UNSIGNED\" => Value::Unsigned(\n                            row.try_get(c.ordinal())\n                                .expect(\"Failed to get unsigned integer\"),\n                        ),\n                        \"MEDIUMINT UNSIGNED\" | \"BIGINT UNSIGNED\" => Value::BigUnsigned(\n                            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                        }","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/sea-orm-sync/src/driver/sqlx_mysql.rs#L387-L423","documentation":"In `from_sqlx_mysql_row_to_proxy_row`, columns typed \"MEDIUMINT UNSIGNED\" or \"BIGINT UNSIGNED\" are decoded with `row.try_get::<u64>` and `.expect(\"Failed to get unsigned big integer\")`. The panic fires when sqlx cannot decode the cell as u64 — most commonly a NULL value requested as a non-Option type, or a decode/type mismatch between the reported column type and the actual value.","triggerScenarios":"Proxy backend query against MySQL returning a MEDIUMINT UNSIGNED / BIGINT UNSIGNED column that is NULL, or whose value cannot decode into u64 (expressions, casts, or mismatched type_info).","commonSituations":"Nullable BIGINT UNSIGNED columns (e.g. auto-increment ids in UNION results) via the proxy backend; COUNT/MAX expressions over unsigned columns returning unexpected types; sqlx version drift.","solutions":["Make the column non-nullable or wrap with COALESCE in the query.","Decode as `Option<u64>` and map NULL to Value::BigUnsigned(None).","Replace .expect with error propagation naming the failing column.","Verify the sqlx runtime matches sea-orm's compiled dependency version."],"exampleFix":"// before\n\"MEDIUMINT UNSIGNED\" | \"BIGINT UNSIGNED\" => Value::BigUnsigned(\n    row.try_get(c.ordinal()).expect(\"Failed to get unsigned big integer\"),\n)\n// after: tolerate NULL\n\"MEDIUMINT UNSIGNED\" | \"BIGINT UNSIGNED\" => Value::BigUnsigned(\n    row.try_get::<Option<u64>, _>(c.ordinal())\n        .expect(\"Failed to get unsigned big integer\"),\n)","handlingStrategy":"validation","validationCode":"// check NULL before decoding MEDIUMINT/BIGINT UNSIGNED as u64\nif row.try_get_raw(c.ordinal())?.is_null()\n    && matches!(c.type_info().name(), \"MEDIUMINT UNSIGNED\" | \"BIGINT UNSIGNED\") {\n    // handle NULL path\n}","typeGuard":null,"tryCatchPattern":"let v: Option<u64> = row.try_get(c.ordinal())?;","preventionTips":["Make BIGINT UNSIGNED id columns NOT NULL.","Be careful with UNION/aggregate queries over unsigned columns — verify resulting types.","Add NULL-row unit tests for proxy row conversion.","Align runtime sqlx with sea-orm's pinned dependency."],"tags":["mysql","sqlx","proxy","type-mismatch","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"}