{"record":{"id":"2d66907d27b2dab9","repo":"SeaQL/sea-orm","slug":"failed-to-get-uuid-array-2d6690","errorCode":null,"errorMessage":"Failed to get uuid array","messagePattern":"Failed to get uuid array","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/driver/sqlx_postgres.rs","lineNumber":935,"sourceCode":"                                    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                    },\n                )\n            })\n            .collect(),\n    }\n}\n","sourceCodeStart":917,"sourceCodeEnd":952,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/src/driver/sqlx_postgres.rs#L917-L952","documentation":"ProxyRow panics with this message when sqlx's `row.try_get::<Option<Vec<uuid::Uuid>>, _>` fails while converting a Postgres UUID[] column into Value::Array(Uuid). try_get errors when the column is not a uuid[] array (scalar uuid, uuid[] stored as text[], nested arrays) or an element cannot be decoded as a 16-byte UUID. The expect() panics on the underlying sqlx error.","triggerScenarios":"A column expected as UUID[] is actually scalar uuid, `text[]`, or a multi-dimensional array; aggregate expressions (e.g. array_agg over text) return non-uuid arrays; postgres-array feature toggles differ from what the value requires.","commonSituations":"array_agg(id) over a text-typed column; columns migrated from text[] to uuid[] without entity update; schemas where tag/permission arrays were stored as text arrays; feature flags missing postgres-array so the value shape differs.","solutions":["Verify the column type is `uuid[]` (element type uuid) in information_schema.columns.","Cast in SQL when the source is text[]: `SELECT tags::uuid[] FROM ...`.","Use `array_agg(id::uuid)` so the aggregate element type is uuid.","Regenerate entities so the field type is Vec<Uuid> matching uuid[].","Unnest multi-dimensional arrays or reshape them in SQL to a 1-D uuid[]."],"exampleFix":"// before: array_agg returns text[] -> panic \"Failed to get uuid array\"\n// SELECT array_agg(tag_id) FROM post_tags\n\n// after\n// SELECT array_agg(tag_id::uuid) AS tag_ids FROM post_tags","handlingStrategy":"validation","validationCode":"let t = sqlx::query(\n    \"SELECT udt_name FROM information_schema.columns WHERE table_name=$1 AND column_name=$2\"\n).bind(\"posts\").bind(\"tag_ids\")\n .fetch_one(db).await?;\nassert_eq!(t.get::<String,_>(\"udt_name\"), \"_uuid\");","typeGuard":"fn as_uuid_vec(vals: &[String]) -> Option<Vec<uuid::Uuid>> {\n    vals.iter().map(|s| uuid::Uuid::parse_str(s).ok()).collect()\n}","tryCatchPattern":"let out = std::panic::catch_unwind(|| {\n    // conversion reading the uuid[] column\n});\nif out.is_err() {\n    return Err(DbErr::Custom(\"uuid[] column decode failed\".into()));\n}","preventionTips":["Ensure aggregate expressions like array_agg produce uuid[] (cast elements: array_agg(col::uuid)).","Check that array columns are 1-D and element-typed uuid.","Enable the postgres-array feature wherever uuid[] columns are mapped.","Validate string arrays with parse_str before treating them as UUID arrays."],"tags":["postgres","sqlx","uuid","array","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"e29bcd1b417c41a553b386fe94511d7c64a1c8ec","analyzedAt":"2026-09-10T11:31:52.468Z","contentChangedAt":"2026-09-10T11:31:52.468Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}