{"id":"f0ebe5035c9fab31","repo":"drizzle-team/drizzle-orm","slug":"unknown-type","errorCode":null,"errorMessage":"Unknown type","messagePattern":"Unknown type","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"drizzle-orm/src/aws-data-api/common/index.ts","lineNumber":38,"sourceCode":"\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;\n\t} else {\n\t\treturn undefined;","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/drizzle-team/drizzle-orm/blob/b7862528fd8fc39bc2653a6c18dad7c1f4e68d10/drizzle-orm/src/aws-data-api/common/index.ts#L20-L56","documentation":"The `getValueFromDataApi` scalar-decode fallback: a returned `Field` has none of the recognized scalar keys (`stringValue`, `booleanValue`, `doubleValue`, `isNull`, `longValue`, `blobValue`, or `arrayValue`). The RDS Data API returned a value shape drizzle cannot interpret.","triggerScenarios":"Selecting a value whose Data API representation is empty or uses an unsupported key (e.g. certain large-object or streaming fields), or a response where all keys are undefined.","commonSituations":"Schema/query changes that introduce an exotic column type, AWS SDK version changes that emit new field shapes, or NULL/empty handling differences.","solutions":["Inspect the raw `Field` object drizzle received (log it) to see which key it actually uses.","Cast the problematic column to a known type (`::text`) in the query.","Upgrade drizzle-orm and `@aws-sdk/client-rds-data` to matching recent versions."],"exampleFix":"// before\nawait db.select({ col: table.exoticCol }).from(table);\n// after\nawait db.execute(sql`select exotic_col::text from t`);","handlingStrategy":"try-catch","validationCode":"// Cast unknown scalar columns to text as a safety net\nimport { sql } from 'drizzle-orm';\nconst safe = await db.execute(sql`select exotic_col::text from t`);","typeGuard":"import type { Field } from '@aws-sdk/client-rds-data';\nfunction hasKnownScalar(f: Field): boolean {\n  return [f.stringValue, f.booleanValue, f.doubleValue, f.isNull, f.longValue, f.blobValue, f.arrayValue]\n    .some((v) => v !== undefined);\n}","tryCatchPattern":"try {\n  rows = await db.select().from(table);\n} catch (e) {\n  if ((e as Error).message === 'Unknown type') {\n    // log the raw Field to identify which key it actually carries\n    rows = await db.execute(sql`select *::text from t`);\n  } else throw e;\n}","preventionTips":["Project only columns you know the Data API can represent.","Keep drizzle-orm and @aws-sdk/client-rds-data versions current."],"tags":["drizzle-orm","aws-data-api","result-mapping"],"analyzedSha":"b7862528fd8fc39bc2653a6c18dad7c1f4e68d10","analyzedAt":"2026-08-03T18:11:14.318Z","schemaVersion":2}