windmill-labs/windmill · error

Unknown TriggerKind: ${kind}

Error message

Unknown TriggerKind: ${kind}

What it means

triggerKindToTriggerType translates the frontend TriggerKind into the backend TriggerType ('webhooks'→'webhook', etc.). Unknown kinds hit the default branch and throw. It guards deploy/processing code against trigger kinds that have no backend type mapping yet.

Source

Thrown at frontend/src/lib/components/triggers/utils.ts:344

			return 'postgres'
		case 'kafka':
			return 'kafka'
		case 'nats':
			return 'nats'
		case 'mqtt':
			return 'mqtt'
		case 'amqp':
			return 'amqp'
		case 'sqs':
			return 'sqs'
		case 'gcp':
			return 'gcp'
		case 'azure':
			return 'azure'
		case 'scheduledPoll':
			return 'poll'
		default:
			throw new Error(`Unknown TriggerKind: ${kind}`)
	}
}

export async function deployTriggers(
	triggersToDeploy: Trigger[],
	workspaceId: string | undefined,
	isAdmin: boolean,
	usedTriggerKinds: Writable<string[]>,
	initialPath?: string,
	isNew?: boolean
) {
	if (!workspaceId) return

	if (isNew && initialPath) {
		triggersToDeploy.forEach((trigger) => {
			trigger.draftConfig = {
				...trigger.draftConfig,
				script_path: initialPath

View on GitHub (pinned to e474e8803c)

Solutions

  1. Add a case for the missing kind in triggerKindToTriggerType, mapping it to the correct TriggerType.
  2. Sync frontend and backend versions if the kind was introduced in a newer release.
  3. Log the full kind value from the message and check TRIGGER_KINDS/enum definitions for the intended mapping.
  4. Migrate stale persisted data that references removed kinds.

Example fix

// before
case 'scheduledPoll':
  return 'poll'
default:
  throw new Error(`Unknown TriggerKind: ${kind}`)
// after
case 'scheduledPoll':
  return 'poll'
case 'azure':
  return 'azure'
default:
  console.warn(`Unknown TriggerKind: ${kind}`)
  return undefined
Defensive patterns

Strategy: type-guard

Validate before calling

const MAPPINGS: Record<string, TriggerType> = { webhooks:'webhook', emails:'email', default_emails:'default_email', schedules:'schedule', routes:'http', websockets:'websocket', postgres:'postgres', kafka:'kafka', nats:'nats', mqtt:'mqtt', amqp:'amqp', sqs:'sqs', gcp:'gcp', azure:'azure', scheduledPoll:'poll' }
function isMappedKind(kind: string): boolean {
  return kind in MAPPINGS
}

Type guard

function isTriggerKind(k: string): k is TriggerKind {
  return k in MAPPINGS
}

Try / catch

try {
  const type = triggerKindToTriggerType(kind)
} catch (e) {
  console.warn(`No TriggerType mapping for ${kind}; skipping`)
  return undefined
}

Prevention

When it happens

Trigger: Calling triggerKindToTriggerType (directly or via the `triggerType` derived/consumer) with a TriggerKind not present in the switch — e.g. a newly added kind missing its mapping, or legacy/stale data containing a removed kind.

Common situations: Frontend/backend version skew after adding a new trigger integration; a kind added to the TriggerKind union but not to this migration mapper; corrupted/stale workspace trigger settings.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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