drizzle-team/drizzle-orm · error · Error

No values to set

Error message

No values to set

What it means

Error "No values to set" thrown in drizzle-team/drizzle-orm.

Source

Thrown at drizzle-orm/src/utils.ts:128

	return true;
}

/** @internal */
export function mapUpdateSet(table: Table, values: Record<string, unknown>): UpdateSet {
	const entries: [string, UpdateSet[string]][] = Object.entries(values)
		.filter(([, value]) => value !== undefined)
		.map(([key, value]) => {
			// eslint-disable-next-line unicorn/prefer-ternary
			if (is(value, SQL) || is(value, Column)) {
				return [key, value];
			} else {
				return [key, new Param(value, table[Table.Symbol.Columns][key])];
			}
		});

	if (entries.length === 0) {
		throw new Error('No values to set');
	}

	return Object.fromEntries(entries);
}

export type UpdateSet = Record<string, SQL | Param | AnyColumn | null | undefined>;

export type OneOrMany<T> = T | T[];

export type Update<T, TUpdate> =
	& {
		[K in Exclude<keyof T, keyof TUpdate>]: T[K];
	}
	& TUpdate;

export type Simplify<T> =
	& {
		// @ts-ignore - "Type parameter 'K' has a circular constraint", not sure why

View on GitHub (pinned to b7862528fd)

Solutions

  1. Pass a non-empty object to .set() in the update builder, e.g. .set({ col: value }).
  2. Guard the update so it only runs when there is at least one field to update.

When it happens

Trigger: Calling update().set() with an object that contains no defined values to set.

Common situations: Building the set object dynamically where every field is undefined; spreading an empty patch object.


AI-assisted analysis of drizzle-team/drizzle-orm@b7862528fd (2026-08-03). Data as JSON: /data/errors/637a20d09289015a.json. Report an issue: GitHub.