{"record":{"id":"4fa8aed47ce0099d","repo":"SeaQL/sea-orm","slug":"failed-to-get-bytes-4fa8ae","errorCode":null,"errorMessage":"Failed to get bytes","messagePattern":"Failed to get bytes","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/driver/sqlx_mysql.rs","lineNumber":439,"sourceCode":"                                .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\n                        \"CHAR\" | \"VARCHAR\" | \"TINYTEXT\" | \"TEXT\" | \"MEDIUMTEXT\" | \"LONGTEXT\" => {\n                            Value::String(\n                                row.try_get::<Option<String>, _>(c.ordinal())\n                                    .expect(\"Failed to get string\")\n                                    .map(Box::new),\n                            )\n                        }\n\n                        #[cfg(feature = \"with-chrono\")]\n                        \"TIMESTAMP\" => Value::ChronoDateTimeUtc(\n                            row.try_get::<Option<chrono::DateTime<chrono::Utc>>, _>(c.ordinal())\n                                .expect(\"Failed to get timestamp\")\n                                .map(Box::new),\n                        ),\n                        #[cfg(all(feature = \"with-time\", not(feature = \"with-chrono\")))]","sourceCodeStart":421,"sourceCodeEnd":457,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/src/driver/sqlx_mysql.rs#L421-L457","documentation":"`ProxyRow` decodes MySQL binary columns (BIT, BINARY, VARBINARY, TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB) with `row.try_get::<Option<Vec<u8>>>` and `.expect(\"Failed to get bytes\")`. Because the target is `Option<Vec<u8>>`, NULL is handled — so this panic means sqlx fundamentally could not decode the cell as binary data (incompatible type, driver/charset conversion issue, or metadata/actual-type mismatch).","triggerScenarios":"A binary-typed column whose driver-side value is not decodable as bytes — e.g. mock proxy rows supplying a string/JSON value for a BLOB column, or a BIT column value surfaced in a form sqlx won't decode into Vec<u8> — while using the proxy driver.","commonSituations":"Proxy/mock test handlers emitting text values for BLOB columns; BIT(1) columns interacting poorly with driver typing; schema drift where a text column was described as binary; encoding/charset conversions corrupting the value type.","solutions":["Fix the proxy/mock handler to return `Vec<u8>` values for binary columns","If the column is actually text, align the entity/SQL so it is decoded by the string arm instead","Check BIT column widths and select them via the entity's typed mapping","Regenerate entities from the live schema to remove type drift"],"exampleFix":"// before (mock proxy row for a BLOB column)\nValue::String(\"binary-data\".into())\n// after\nValue::Bytes(Box::new(vec![0x62, 0x69, 0x6e]))","handlingStrategy":"validation","validationCode":"// Verify binary columns and that handlers supply bytes\nSELECT COLUMN_TYPE, IS_NULLABLE FROM information_schema.COLUMNS\nWHERE TABLE_SCHEMA = ? AND TABLE_NAME = ? AND COLUMN_NAME = ?;\n// COLUMN_TYPE should be one of: bit/binary/varbinary/tinyblob/blob/mediumblob/longblob","typeGuard":"fn is_binary_column(col_type: &str) -> bool {\n    matches!(col_type.to_ascii_lowercase().as_str(),\n        \"bit\" | \"binary\" | \"varbinary\" | \"tinyblob\" | \"blob\" | \"mediumblob\" | \"longblob\")\n}","tryCatchPattern":null,"preventionTips":["In proxy/mock tests, always emit Vec<u8> for binary columns","Do not store binary data in TEXT columns (or vice versa)","Verify BIT column widths are supported by your driver version","Keep entities regenerated so text/binary arms match reality"],"tags":["mysql","sqlx","decoding","blob"],"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"}