{"record":{"id":"39cf417878cd6a1a","repo":"SeaQL/sea-orm","slug":"failed-to-get-string-39cf41","errorCode":null,"errorMessage":"Failed to get string","messagePattern":"Failed to get string","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sea-orm-sync/src/driver/sqlx_sqlite.rs","lineNumber":432,"sourceCode":"                        \"BOOLEAN\" => {\n                            Value::Bool(row.try_get(c.ordinal()).expect(\"Failed to get boolean\"))\n                        }\n\n                        \"INTEGER\" => {\n                            Value::Int(row.try_get(c.ordinal()).expect(\"Failed to get integer\"))\n                        }\n\n                        \"BIGINT\" | \"INT8\" => Value::BigInt(\n                            row.try_get(c.ordinal()).expect(\"Failed to get big integer\"),\n                        ),\n\n                        \"REAL\" => {\n                            Value::Double(row.try_get(c.ordinal()).expect(\"Failed to get double\"))\n                        }\n\n                        \"TEXT\" => Value::String(\n                            row.try_get::<Option<String>, _>(c.ordinal())\n                                .expect(\"Failed to get string\")\n                                .map(Box::new),\n                        ),\n\n                        \"BLOB\" => Value::Bytes(\n                            row.try_get::<Option<Vec<u8>>, _>(c.ordinal())\n                                .expect(\"Failed to get bytes\")\n                                .map(Box::new),\n                        ),\n\n                        #[cfg(feature = \"with-chrono\")]\n                        \"DATETIME\" => {\n                            use chrono::{DateTime, Utc};\n\n                            Value::ChronoDateTimeUtc(\n                                row.try_get::<Option<DateTime<Utc>>, _>(c.ordinal())\n                                    .expect(\"Failed to get timestamp\")\n                                    .map(Box::new),\n                            )","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/sea-orm-sync/src/driver/sqlx_sqlite.rs#L414-L450","documentation":"Panic when sea-orm-sync's SQLite driver cannot decode a \"TEXT\" column into Option<String> while building a ProxyRow. Although the target is an Option, sqlx still fails when the underlying storage class is not text (e.g. BLOB or numeric) under a TEXT-typed column, thanks to SQLite's dynamic typing.","triggerScenarios":"Reading a TEXT column whose stored value has storage class BLOB or INTEGER/REAL that sqlx won't decode into Option<String>, or other sqlx-level decode errors on the column.","commonSituations":"Strings inserted as BLOBs (e.g. via bytes buffers in another driver); columns declared TEXT but holding numeric data inserted via raw SQL; corruption or mixed-type data imported from other databases.","solutions":["Normalize storage: UPDATE t SET col = CAST(col AS TEXT) WHERE typeof(col) != 'text'","Verify with SELECT typeof(col), count(*) GROUP BY typeof(col) to find offending rows","Insert data through typed entity models so SQLite affinity converts values to text","Propagate the sqlx error with column context instead of .expect and fall back to reading bytes"],"exampleFix":"// before\n\"TEXT\" => Value::String(\n    row.try_get::<Option<String>, _>(c.ordinal())\n        .expect(\"Failed to get string\")\n        .map(Box::new),\n),\n// after\n\"TEXT\" => Value::String(\n    row.try_get::<Option<String>, _>(c.ordinal())\n        .unwrap_or_else(|e| panic!(\"Failed to get string for col {}: {}\", c.name(), e))\n        .map(Box::new),\n)   // better: fall back to CAST(col AS TEXT) at query time","handlingStrategy":"validation","validationCode":"// Verify TEXT columns hold text storage class:\n// SELECT typeof(col), count(*) FROM t GROUP BY typeof(col);","typeGuard":"fn is_text_storage(type_of: &str) -> bool { type_of == \"text\" }","tryCatchPattern":"let row = std::panic::catch_unwind(|| proxy_query(db)).unwrap_or_else(|_| fallback_row());","preventionTips":["CAST blobs/numbers to TEXT when a column is declared TEXT","Avoid inserting bytes into text columns via other drivers","Use typed entity models for string fields","Run a typeof() audit after each data import"],"tags":["rust","sqlx","sqlite","string","type-conversion","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-14T11:17:12.474Z"}