{"record":{"id":"94b1fdf32144ad37","repo":"SeaQL/sea-orm","slug":"failed-to-get-uuid","errorCode":null,"errorMessage":"Failed to get uuid","messagePattern":"Failed to get uuid","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sea-orm-sync/src/driver/sqlx_postgres.rs","lineNumber":915,"sourceCode":"                            feature = \"postgres-array\"\n                        ))]\n                        \"TIMETZ[]\" => Value::Array(\n                            sea_query::ArrayType::TimeTime,\n                            row.try_get::<Option<Vec<time::Time>>, _>(c.ordinal())\n                                .expect(\"Failed to get timetz array\")\n                                .map(|vals| {\n                                    Box::new(\n                                        vals.into_iter()\n                                            .map(|val| Value::TimeTime(Some(val)))\n                                            .collect(),\n                                    )\n                                }),\n                        ),\n\n                        #[cfg(feature = \"with-uuid\")]\n                        \"UUID\" => Value::Uuid(\n                            row.try_get::<Option<uuid::Uuid>, _>(c.ordinal())\n                                .expect(\"Failed to get uuid\"),\n                        ),\n\n                        #[cfg(all(feature = \"with-uuid\", feature = \"postgres-array\"))]\n                        \"UUID[]\" => Value::Array(\n                            sea_query::ArrayType::Uuid,\n                            row.try_get::<Option<Vec<uuid::Uuid>>, _>(c.ordinal())\n                                .expect(\"Failed to get uuid array\")\n                                .map(|vals| {\n                                    Box::new(\n                                        vals.into_iter()\n                                            .map(|val| Value::Uuid(Some(val)))\n                                            .collect(),\n                                    )\n                                }),\n                        ),\n\n                        _ => unreachable!(\"Unknown column type: {}\", c.type_info().name()),\n                    },","sourceCodeStart":897,"sourceCodeEnd":933,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/sea-orm-sync/src/driver/sqlx_postgres.rs#L897-L933","documentation":"This panic occurs in sea-orm-sync's PostgreSQL driver when converting a raw sqlx row into a ProxyRow. For a column whose declared type is \"UUID\", the code calls row.try_get::<Option<uuid::Uuid>>() and .expect()s success, so any sqlx decode error (or unexpected null handling mismatch) aborts the process instead of returning a Result.","triggerScenarios":"Querying a Postgres UUID column via ProxyRow when the actual value cannot be decoded into Option<uuid::Uuid> — e.g. the value is NULL but the runtime type info says UUID and the non-Option path is taken, the column type string mismatches the stored value, or the uuid feature's decode fails on a malformed UUID stored as text.","commonSituations":"Reading a UUID column that was written by another tool as a plain text value with different formatting; schema drift where a column was ALTERed from uuid to text/varchar but cached metadata still reports \"UUID\"; using an older sqlx/uuid version pair with incompatible decoding.","solutions":["Check the actual stored value and column type in Postgres (\\d table / SELECT ::text) to confirm it is a valid 16-byte uuid value","Align the entity/ProxyRow decode path with the real column type so the match arm matches the true type_info name","Pin compatible sqlx and uuid crate versions (sqlx's uuid feature vs uuid crate major version)","If you control the code, replace .expect with proper error propagation and fall back to Value::String for undecodable values"],"exampleFix":"// before\n\"UUID\" => Value::Uuid(\n    row.try_get::<Option<uuid::Uuid>, _>(c.ordinal())\n        .expect(\"Failed to get uuid\"),\n),\n// after\n\"UUID\" => Value::Uuid(\n    row.try_get::<Option<uuid::Uuid>, _>(c.ordinal())\n        .unwrap_or_else(|e| panic!(\"Failed to get uuid for col {} ({}): {}\", c.name(), c.type_info().name(), e)),\n),","handlingStrategy":"validation","validationCode":"// Before reading UUID columns, verify stored values are valid uuids:\n// SELECT col::text FROM t WHERE col IS NOT NULL AND col::text !~ '^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$';\nfn is_uuid_column(type_name: &str) -> bool { type_name == \"UUID\" }","typeGuard":"fn decode_uuid(v: Option<uuid::Uuid>) -> Option<uuid::Uuid> { v }","tryCatchPattern":"// ProxyRow panics rather than returning Result; catch at the query boundary in an app:\nlet row = std::panic::catch_unwind(|| proxy_query(db)).unwrap_or_else(|_| fallback_row());","preventionTips":["Confirm column types with \\d before mapping them as UUID in ProxyRow","Use typed entity models instead of raw ProxyRow reads for uuid columns","Pin matching sqlx/uuid crate versions","Add a smoke test reading a sample row of every uuid column at deploy time"],"tags":["rust","sqlx","postgres","uuid","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-14T05:17:10.506Z"}