{"id":"930cef0573fe5dda","repo":"drizzle-team/drizzle-orm","slug":"unknown-array-type","errorCode":null,"errorMessage":"Unknown array type","messagePattern":"Unknown array type","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"drizzle-orm/src/aws-data-api/common/index.ts","lineNumber":36,"sourceCode":"\t\t// eslint-disable-next-line unicorn/no-negated-condition\n\t} else if (field.arrayValue !== undefined) {\n\t\tif (field.arrayValue.stringValues !== undefined) {\n\t\t\treturn field.arrayValue.stringValues;\n\t\t}\n\t\tif (field.arrayValue.longValues !== undefined) {\n\t\t\treturn field.arrayValue.longValues;\n\t\t}\n\t\tif (field.arrayValue.doubleValues !== undefined) {\n\t\t\treturn field.arrayValue.doubleValues;\n\t\t}\n\t\tif (field.arrayValue.booleanValues !== undefined) {\n\t\t\treturn field.arrayValue.booleanValues;\n\t\t}\n\t\tif (field.arrayValue.arrayValues !== undefined) {\n\t\t\treturn field.arrayValue.arrayValues;\n\t\t}\n\n\t\tthrow new Error('Unknown array type');\n\t} else {\n\t\tthrow new Error('Unknown type');\n\t}\n}\n\nexport function typingsToAwsTypeHint(typings?: QueryTypingsValue): TypeHint | undefined {\n\tif (typings === 'date') {\n\t\treturn TypeHint.DATE;\n\t} else if (typings === 'decimal') {\n\t\treturn TypeHint.DECIMAL;\n\t} else if (typings === 'json') {\n\t\treturn TypeHint.JSON;\n\t} else if (typings === 'time') {\n\t\treturn TypeHint.TIME;\n\t} else if (typings === 'timestamp') {\n\t\treturn TypeHint.TIMESTAMP;\n\t} else if (typings === 'uuid') {\n\t\treturn TypeHint.UUID;","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-orm/src/aws-data-api/common/index.ts#L18-L54","documentation":"In the AWS RDS Data API result mapper, an array-typed `Field` was returned but its `arrayValue` did not contain any of the recognized element arrays (`stringValues`, `longValues`, `doubleValues`, `booleanValues`, `arrayValues`). This is an unrecognized/nested array shape the mapper cannot decode.","triggerScenarios":"Selecting an array column whose element type the RDS Data API represents with an unsupported/unhandled `arrayValue` variant (e.g. blob arrays, null arrays, or newer array element kinds). Triggered on the `getValueFromDataApi(field)` path during result decoding.","commonSituations":"Querying Postgres array columns with element types like `bytea[]`, `numeric[]` where the Data API returns a non-string/long/double/boolean variant, or after an AWS SDK upgrade that changed `arrayValue` shapes.","solutions":["Cast the array column to a text representation in SQL (`array_col::text`) and decode it client-side.","Avoid selecting unsupported array element types through the Data API; fetch them via a non-array projection.","Upgrade drizzle-orm; newer versions add element-type handling for arrays."],"exampleFix":"// before\nconst rows = await db.select({ arr: table.byteaArr }).from(table);\n// after - cast to text\nconst rows = await db.execute(sql`select bytea_arr::text from t`);","handlingStrategy":"try-catch","validationCode":"// Cast exotic array columns to text before selecting via Data API\nimport { sql } from 'drizzle-orm';\nconst safe = await db.execute(sql`select bytea_arr_col::text from t`);","typeGuard":"import type { Field } from '@aws-sdk/client-rds-data';\nfunction hasKnownArrayValue(f: Field): boolean {\n  const a = f.arrayValue;\n  return !!a && (!!a.stringValues || !!a.longValues || !!a.doubleValues || !!a.booleanValues || !!a.arrayValues);\n}","tryCatchPattern":"try {\n  rows = await db.select({ arr: table.col }).from(table);\n} catch (e) {\n  if ((e as Error).message === 'Unknown array type') {\n    rows = await db.execute(sql`select col::text from ${table}`);\n  } else throw e;\n}","preventionTips":["Cast unusual array element types to text in the query.","Track drizzle-orm releases for expanded array support."],"tags":["drizzle-orm","aws-data-api","arrays","result-mapping"],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}