drizzle-team/drizzle-orm · error · Error
Unknown type
Error message
Unknown type
What it means
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.
Source
Thrown at drizzle-orm/src/aws-data-api/common/index.ts:38
if (field.arrayValue.stringValues !== undefined) {
return field.arrayValue.stringValues;
}
if (field.arrayValue.longValues !== undefined) {
return field.arrayValue.longValues;
}
if (field.arrayValue.doubleValues !== undefined) {
return field.arrayValue.doubleValues;
}
if (field.arrayValue.booleanValues !== undefined) {
return field.arrayValue.booleanValues;
}
if (field.arrayValue.arrayValues !== undefined) {
return field.arrayValue.arrayValues;
}
throw new Error('Unknown array type');
} else {
throw new Error('Unknown type');
}
}
export function typingsToAwsTypeHint(typings?: QueryTypingsValue): TypeHint | undefined {
if (typings === 'date') {
return TypeHint.DATE;
} else if (typings === 'decimal') {
return TypeHint.DECIMAL;
} else if (typings === 'json') {
return TypeHint.JSON;
} else if (typings === 'time') {
return TypeHint.TIME;
} else if (typings === 'timestamp') {
return TypeHint.TIMESTAMP;
} else if (typings === 'uuid') {
return TypeHint.UUID;
} else {
return undefined;View on GitHub (pinned to b7862528fd)
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.
Example fix
// before
await db.select({ col: table.exoticCol }).from(table);
// after
await db.execute(sql`select exotic_col::text from t`); Defensive patterns
Strategy: try-catch
Validate before calling
// Cast unknown scalar columns to text as a safety net
import { sql } from 'drizzle-orm';
const safe = await db.execute(sql`select exotic_col::text from t`); Type guard
import type { Field } from '@aws-sdk/client-rds-data';
function hasKnownScalar(f: Field): boolean {
return [f.stringValue, f.booleanValue, f.doubleValue, f.isNull, f.longValue, f.blobValue, f.arrayValue]
.some((v) => v !== undefined);
} Try / catch
try {
rows = await db.select().from(table);
} catch (e) {
if ((e as Error).message === 'Unknown type') {
// log the raw Field to identify which key it actually carries
rows = await db.execute(sql`select *::text from t`);
} else throw e;
} Prevention
- Project only columns you know the Data API can represent.
- Keep drizzle-orm and @aws-sdk/client-rds-data versions current.
When it happens
Trigger: 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.
Common situations: Schema/query changes that introduce an exotic column type, AWS SDK version changes that emit new field shapes, or NULL/empty handling differences.
Related errors
- Unknown array type
- Unknown type for ${value}
- Unexpected state: no column metadata found for index ${index
- Unexpected state: no column name for index ${index} found in
- Transaction not supported
AI-assisted analysis of drizzle-team/drizzle-orm@b7862528fd (2026-08-03).
Data as JSON: /data/errors/f0ebe5035c9fab31.json.
Report an issue: GitHub.