drizzle-team/drizzle-orm · error · Error

Unknown type: ${type}

Error message

Unknown type: ${type}

What it means

The Studio Hono server receives a JSON body with a `type` discriminator (`init`, `proxy`, `tproxy`, `defaults`). Reaching the final `throw new Error('Unknown type: ${type}')` means the request's `type` matched none of the handlers — i.e. the Studio frontend sent a message variant the running server does not understand.

Source

Thrown at drizzle-kit/src/serializer/studio.ts:828

				if (!found) {
					throw new Error(
						`Custom default not found for ${column.schema}.${column.table}.${column.column}`,
					);
				}

				const value = found.func();

				return {
					...column,
					value,
				};
			});

			return c.json(JSON.parse(jsonStringify(result)));
		}

		throw new Error(`Unknown type: ${type}`);
	});

	return {
		start: (params: Parameters<Server['start']>[0]) => {
			serve(
				{
					fetch: app!.fetch,
					createServer: params.key ? createServer : undefined,
					hostname: params.host,
					port: params.port,
					serverOptions: {
						key: params.key,
						cert: params.cert,
					},
				},
				() => params.cb(null, `${params.host}:${params.port}`),
			);
		},

View on GitHub (pinned to b7862528fd)

Solutions

  1. Hard-refresh the Studio browser tab (clear cache) to load the UI matching the current drizzle-kit.
  2. Reinstall/upgrade `drizzle-kit` to a single coherent version.
  3. Avoid sending manual requests to the Studio HTTP endpoint; only the bundled UI should call it.

Example fix

// not a code fix - clear browser cache / restart studio
// kill the process and re-run:
// npx drizzle-kit studio
Defensive patterns

Strategy: validation

Validate before calling

// Only the bundled Studio UI should call the server; guard request type
const KNOWN = new Set(['init', 'proxy', 'tproxy', 'defaults']);
function assertKnownType(t: string) { if (!KNOWN.has(t)) throw new Error('Bad type'); }

Type guard

function isStudioMessageType(t: unknown): t is 'init' | 'proxy' | 'tproxy' | 'defaults' {
  return typeof t === 'string' && ['init', 'proxy', 'tproxy', 'defaults'].includes(t);
}

Try / catch

// Not catchable client-side; the fix is to align versions.
// Restart studio and hard-refresh the browser if seen.

Prevention

When it happens

Trigger: A version skew between the Studio frontend (shipped via `drizzle-kit`) and the Studio backend server, or a hand-crafted/curl request to the Studio HTTP endpoint with an unsupported `type` field.

Common situations: Caching an old Studio web UI in the browser while running a newer/older `drizzle-kit`, or a partial upgrade where the CLI and the cached UI diverge.

Related errors


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