drizzle-team/drizzle-orm · error · Error

unsupported dialect

Error message

unsupported dialect

What it means

Thrown during Studio relation extraction when the `referencedTable` on a relation is not an instance of `PgTable`, `MySqlTable`, `SQLiteTable`, or `SingleStoreTable`. The serializer walks each relation's target table to find its schema; an unrecognized table class means the dialect is one Studio's relation extractor does not handle, or a cross-dialect/corrupted table object reached the extractor.

Source

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

					const refTable = rel.referencedTable;
					const fields = normalized.fields
						.map((it) => getColumnCasing(it, casing))
						.flat();
					const refColumns = normalized.references
						.map((it) => getColumnCasing(it, casing))
						.flat();

					let refSchema: string | undefined;
					if (is(refTable, PgTable)) {
						refSchema = pgTableConfig(refTable).schema;
					} else if (is(refTable, MySqlTable)) {
						refSchema = mysqlTableConfig(refTable).schema;
					} else if (is(refTable, SQLiteTable)) {
						refSchema = undefined;
					} else if (is(refTable, SingleStoreTable)) {
						refSchema = singlestoreTableConfig(refTable).schema;
					} else {
						throw new Error('unsupported dialect');
					}

					let type: 'one' | 'many';
					if (is(rel, One)) {
						type = 'one';
					} else if (is(rel, Many)) {
						type = 'many';
					} else {
						throw new Error('unsupported relation type');
					}

					return {
						name,
						type,
						table: it.dbName,
						schema: it.schema || 'public',
						columns: fields,
						refTable: refTableName,

View on GitHub (pinned to b7862528fd)

Solutions

  1. Align drizzle-orm and drizzle-kit to the same version (`pnpm update drizzle-orm drizzle-kit`).
  2. Ensure the schema only uses tables from a single supported dialect (pg/mysql/sqlite/singlestore).
  3. If using an experimental/new dialect, wait for Studio support or avoid the Relations API for those tables.

Example fix

// before - mismatched versions
"drizzle-orm": "1.0.0", "drizzle-kit": "0.30.0"
// after
"drizzle-orm": "1.0.0", "drizzle-kit": "1.0.0"
Defensive patterns

Strategy: type-guard

Validate before calling

// Ensure drizzle-orm and drizzle-kit versions match before Studio start
import pkg from './package.json';
function assertVersionAlign() {
  const orm = pkg.dependencies['drizzle-orm'];
  const kit = (pkg.devDependencies ?? pkg.dependencies)['drizzle-kit'];
  if (!orm || !kit) throw new Error('Missing drizzle-orm/drizzle-kit');
}

Type guard

import { is } from 'drizzle-orm';
import { PgTable } from 'drizzle-orm/pg-core';
import { MySqlTable } from 'drizzle-orm/mysql-core';
import { SQLiteTable } from 'drizzle-orm/sqlite-core';
import { SingleStoreTable } from 'drizzle-orm/singlestore-core';

function isSupportedRefTable(t: unknown): boolean {
  return is(t, PgTable) || is(t, MySqlTable) || is(t, SQLiteTable) || is(t, SingleStoreTable);
}

Try / catch

try {
  studioSchema = prepareStudioSchema(schema);
} catch (e) {
  if ((e as Error).message === 'unsupported dialect') {
    console.error('Align drizzle-orm & drizzle-kit versions, or remove cross-dialect tables');
  }
  throw e;
}

Prevention

When it happens

Trigger: Loading a schema that mixes table classes from unsupported dialects, or passing a custom/subclassed table into `extractTablesRelationalConfig` whose `referencedTable` is none of the four supported base classes. In practice this fires when an internal upgrade changes table internals or when a non-standard dialect is used.

Common situations: After upgrading drizzle-orm/drizzle-kit to mismatched versions, the `is(refTable, PgTable)` instance checks fail because the class identity changed across packages. Also seen with experimental dialects not yet supported by Studio.

Related errors


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