{"record":{"id":"1985d815fd4677f8","repo":"SeaQL/sea-orm","slug":"failed-to-get-string-1985d8","errorCode":null,"errorMessage":"Failed to get string","messagePattern":"Failed to get string","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/driver/sqlx_mysql.rs","lineNumber":446,"sourceCode":"                        ),\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\")))]\n                        \"TIMESTAMP\" => Value::TimeDateTime(\n                            row.try_get::<Option<time::PrimitiveDateTime>, _>(c.ordinal())\n                                .expect(\"Failed to get timestamp\")\n                                .map(Box::new),\n                        ),\n\n                        #[cfg(feature = \"with-chrono\")]","sourceCodeStart":428,"sourceCodeEnd":464,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/src/driver/sqlx_mysql.rs#L428-L464","documentation":"`ProxyRow` decodes MySQL string columns (CHAR, VARCHAR, TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT) with `row.try_get::<Option<String>>` and `.expect(\"Failed to get string\")`. Since the target is `Option<String>`, NULL is tolerated — this panic means sqlx could not decode the cell as UTF-8 text at all (invalid encoding, binary data in a text column, or metadata/actual-type mismatch).","triggerScenarios":"A text column containing non-UTF-8 bytes (e.g. binary blobs stored in TEXT/VARCHAR, or latin1/binary charset data the driver refuses to decode as String), or mock proxy rows supplying non-string values, decoded via the proxy driver.","commonSituations":"Tables with mixed charset (utf8mb4 vs binary) after a migration; BLOB data accidentally read through a string-typed arm due to stale metadata; proxy/mock handlers returning byte or numeric values for VARCHAR columns.","solutions":["Ensure the connection and column charsets are UTF-8 capable (utf8mb4) and data is valid UTF-8","Fix proxy/mock handlers to return `String` values for text columns","If the column truly holds bytes, migrate it to a BLOB type so the bytes arm decodes it","Regenerate entities from the current schema to eliminate metadata drift"],"exampleFix":"// before\nALTER TABLE t MODIFY col VARBINARY(255); -- read through string arm: panics\n// after\nALTER TABLE t MODIFY col VARCHAR(255) CHARACTER SET utf8mb4;","handlingStrategy":"validation","validationCode":"// Verify text columns hold valid UTF-8\nSELECT COLUMN_NAME, CHARACTER_SET_NAME FROM information_schema.COLUMNS\nWHERE TABLE_SCHEMA = ? AND TABLE_NAME = ? AND COLUMN_NAME = ?;\n// CHARACTER_SET_NAME should be utf8/utf8mb4, not binary/latin1","typeGuard":"fn is_valid_utf8_text(bytes: &[u8]) -> bool { std::str::from_utf8(bytes).is_ok() }","tryCatchPattern":null,"preventionTips":["Use utf8mb4 charset for text columns and connections","Never store raw bytes in VARCHAR/TEXT columns","Keep proxy/mock values as String for text columns","Validate legacy data for encoding issues after migrations"],"tags":["mysql","sqlx","decoding","utf8"],"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"}