{"record":{"id":"4e38289455143acf","repo":"SeaQL/sea-orm","slug":"failed-to-get-integer-4e3828","errorCode":null,"errorMessage":"Failed to get integer","messagePattern":"Failed to get integer","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/driver/sqlx_mysql.rs","lineNumber":424,"sourceCode":"                        ),\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\n                        \"BIT\" | \"BINARY\" | \"VARBINARY\" | \"TINYBLOB\" | \"BLOB\" | \"MEDIUMBLOB\"\n                        | \"LONGBLOB\" => Value::Bytes(\n                            row.try_get::<Option<Vec<u8>>, _>(c.ordinal())\n                                .expect(\"Failed to get bytes\")\n                                .map(Box::new),\n                        ),\n","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/src/driver/sqlx_mysql.rs#L406-L442","documentation":"`ProxyRow` decodes MySQL `INT` columns with `row.try_get::<i32>` followed by `.expect(\"Failed to get integer\")`. A sqlx decode error (NULL value, or value whose type does not match the described INT metadata) causes this panic. It signals that the row's actual value does not conform to the declared non-nullable signed 32-bit integer column.","triggerScenarios":"An INT column that is NULL in the decoded row, or whose underlying value is not i32-compatible (schema drift, mock proxy value of wrong type), while fetching through the proxy driver path.","commonSituations":"Primary-key/foreign-key INT columns coming back NULL from outer joins or aggregate queries (COUNT over empty group with wrong SELECT); entities not regenerated after a migration changed nullability; proxy test handlers returning u32 for an INT column.","solutions":["Make the column NOT NULL or change the entity field to `Option<i32>`","Check the SQL for joins/aggregations that produce NULL in an otherwise NOT NULL column","Regenerate entities to align with the current schema","Fix proxy/mock rows to return `i32` values for INT columns"],"exampleFix":"// before (LEFT JOIN can yield NULL)\npub parent_id: i32,\n// after\npub parent_id: Option<i32>,","handlingStrategy":"validation","validationCode":"// Verify INT columns before decoding\nSELECT COLUMN_TYPE, IS_NULLABLE FROM information_schema.COLUMNS\nWHERE TABLE_SCHEMA = ? AND TABLE_NAME = ? AND COLUMN_NAME = ?;\n// expect COLUMN_TYPE = 'int', IS_NULLABLE = 'NO'","typeGuard":"fn is_i32_compatible(col_type: &str, nullable: bool, value_is_null: bool) -> bool {\n    col_type.eq_ignore_ascii_case(\"int\") && !nullable && !value_is_null\n}","tryCatchPattern":null,"preventionTips":["Use Option<i32> for join-produced nullable foreign keys","Avoid COUNT/aggregate subqueries that can return NULL into i32 fields","Keep mock proxy rows typed as i32 for INT columns","Regenerate entities after migrations"],"tags":["mysql","sqlx","decoding","proxy-driver"],"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"}