{"record":{"id":"1036e2686ca2955d","repo":"SeaQL/sea-orm","slug":"failed-to-get-tiny-integer","errorCode":null,"errorMessage":"Failed to get tiny integer","messagePattern":"Failed to get tiny integer","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sea-orm-sync/src/driver/sqlx_mysql.rs","lineNumber":409,"sourceCode":"                        \"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                        }\n                        \"DOUBLE\" => {\n                            Value::Double(row.try_get(c.ordinal()).expect(\"Failed to get double\"))\n                        }\n","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/sea-orm-sync/src/driver/sqlx_mysql.rs#L391-L427","documentation":"In `from_sqlx_mysql_row_to_proxy_row`, a column typed \"TINYINT\" (signed) is decoded with `row.try_get::<i8>` and `.expect(\"Failed to get tiny integer\")`. The panic occurs when sqlx cannot decode the cell as i8 — typically a NULL requested as non-Option i8, or a type mismatch between the reported column type and the actual decoded value. Note MySQL reports TINYINT(1) as \"TINYINT(1)\", so a plain \"TINYINT\" branch sees other signed tinyint values.","triggerScenarios":"Proxy backend query against MySQL returning a signed TINYINT column that is NULL, or whose value fails i8 decoding (e.g. a boolean-ish or wider value under a mismatched type_info name).","commonSituations":"Nullable signed tinyint columns through the proxy backend; sqlx MySQL type_info naming differences across versions making the branch match the wrong value; computed columns reporting TINYINT while decoding differently.","solutions":["Make the column non-nullable or use COALESCE in the query.","Decode as `Option<i8>` and map NULL to Value::TinyInt(None).","Propagate the decode error as DbErr instead of panicking.","Confirm the sqlx version in use matches sea-orm's pinned sqlx."],"exampleFix":"// before\n\"TINYINT\" => Value::TinyInt(\n    row.try_get(c.ordinal()).expect(\"Failed to get tiny integer\"),\n)\n// after: tolerate NULL\n\"TINYINT\" => Value::TinyInt(\n    row.try_get::<Option<i8>, _>(c.ordinal())\n        .expect(\"Failed to get tiny integer\"),\n)","handlingStrategy":"validation","validationCode":"// check NULL before decoding TINYINT as i8\nif row.try_get_raw(c.ordinal())?.is_null() && c.type_info().name() == \"TINYINT\" {\n    // handle NULL path\n}","typeGuard":null,"tryCatchPattern":"let v: Option<i8> = row.try_get(c.ordinal())?;","preventionTips":["Declare signed tinyint columns NOT NULL when values are mandatory.","Remember TINYINT(1) is routed to the boolean branch — check which branch your column hits.","Cover proxy conversion with NULL fixtures.","Pin sqlx to the version sea-orm was built with."],"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"}