windmill-labs/windmill · error

Unsupported database type

Error message

Unsupported database type

What it means

formatInsertValues renders the VALUES(...) placeholder list for an INSERT, with per-database syntax (named params for mysql/duckdb, positional $n::type for postgres, @p for mssql, ? for snowflake, @field for bigquery). The default branch throws when dbType is unrecognized. This happens before any SQL is sent, so the error indicates a type the builder simply has no syntax for.

Source

Thrown at frontend/src/lib/components/apps/components/display/dbtable/queries/insert.ts:31

import { buildParameters, ColumnIdentity } from '../utils'
import { getLanguageByResourceType, type ColumnDef } from '../utils'

function formatInsertValues(columns: ColumnDef[], dbType: DbType, startIndex: number = 1): string {
	switch (dbType) {
		case 'mysql':
			return columns.map((c) => `:${c.field}`).join(', ')
		case 'postgresql':
			return columns.map((c, i) => `$${startIndex + i}::${c.datatype}`).join(', ')
		case 'ms_sql_server':
			return columns.map((c, i) => `@p${startIndex + i}`).join(', ')
		case 'snowflake':
			return columns.map(() => `?`).join(', ')
		case 'bigquery':
			return columns.map((c) => `@${c.field}`).join(', ')
		case 'duckdb':
			return columns.map((c) => `$${c.field}`).join(', ')
		default:
			throw new Error('Unsupported database type')
	}
}

function formatColumnNames(columns: ColumnDef[]): string {
	return columns.map((c) => c.field).join(', ')
}

function getUserDefaultValue(column: ColumnDef) {
	if (column.defaultValueNull) {
		return 'NULL'
	} else if (column.defaultUserValue) {
		return typeof column.defaultUserValue === 'string'
			? `'${column.defaultUserValue}'`
			: column.defaultUserValue
	}
}

function formatDefaultValues(columns: ColumnDef[]): string {

View on GitHub (pinned to e474e8803c)

Solutions

  1. Confirm the resource's resourceType is one of the six handled kinds.
  2. Normalize ducklake to 'duckdb' before building the insert query.
  3. Add a case to formatInsertValues for the new dbType, or migrate the app to the Database Manager (WM_INTERNAL_DB) flow.
  4. Print dbType in the error message locally while debugging to identify the exact value.

Example fix

// before
const query = makeInsertQuery(table, columns, dbInput.resourceType)
// after
const dbType = dbInput.type === 'ducklake' ? 'duckdb' : dbInput.resourceType
const query = makeInsertQuery(table, columns, dbType)
Defensive patterns

Strategy: validation

Validate before calling

const dbType = dbInput.type === 'ducklake' ? 'duckdb' : dbInput.resourceType
if (!['mysql','postgresql','ms_sql_server','snowflake','bigquery','duckdb'].includes(dbType)) {
  throw new Error(`Inserts unsupported for dbType "${dbType}"`)
}
const query = makeInsertQuery(table, columns, dbType)

Type guard

function supportsInsert(t: string): t is DbType {
  return ['mysql','postgresql','ms_sql_server','snowflake','bigquery','duckdb'].includes(t)
}

Try / catch

try {
  return getInsertInput(dbInput, table, columns)
} catch (e) {
  if (e instanceof Error && e.message === 'Unsupported database type') {
    console.error('insert unsupported for', dbInput.resourceType)
    return null
  }
  throw e
}

Prevention

When it happens

Trigger: makeInsertQuery called with a dbType outside mysql/postgresql/ms_sql_server/snowflake/bigquery/duckdb — typically an unmapped resource type or a newly added integration the legacy builder doesn't cover.

Common situations: Inserting via the legacy Database Studio table editor against a database resource of an unsupported/new type; ducklake input not normalized to 'duckdb'; typo in resourceType configuration.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/272d7394afc8b693. Report an issue: GitHub.