windmill-labs/windmill · error · Error

Missing trigger kind

Error message

Missing trigger kind

What it means

openCreatedResource resolves which drawer to open via the action's key: schedules map to 'schedule', everything else uses action.triggerKind. If neither yields a value the action carries no usable drawer key, so it throws 'Missing trigger kind'.

Source

Thrown at frontend/src/lib/components/copilot/chat/CreatedResourceActionDrawers.svelte:138

	async function openCreatedResource(action: ToolDisplayAction) {
		if (action.type !== 'open_created_resource') {
			return
		}

		if (action.resource === 'resource') {
			await resourceEditorDrawer?.initEdit(action.path)
			return
		}

		if (action.resource === 'variable') {
			await variableEditor?.editVariable(action.path)
			return
		}

		const key = action.resource === 'schedule' ? 'schedule' : action.triggerKind
		if (!key) {
			throw new Error('Missing trigger kind')
		}

		if (activeDrawer?.key === key && activeDrawer.path === action.path && drawer?.isOpen()) {
			activeDrawer = undefined
			editor = undefined
			drawer.closeDrawer()
			return
		}

		const config = drawerConfigs[key]
		const promise = activeDrawer?.key === key ? activeDrawer.promise : config.load()
		if (activeDrawer?.key !== key) {
			editor = undefined
		}

		const request: ActiveDrawerState = {
			id: nextActiveDrawerId++,
			key,

View on GitHub (pinned to e474e8803c)

Solutions

  1. Ensure the backend/tool sets action.triggerKind when emitting open_created_resource for trigger resources
  2. Add the new trigger kind to drawerConfigs so it resolves to a drawer key
  3. Guard the call: skip or toast when action.triggerKind is missing instead of throwing

Example fix

// before
const key = action.resource === 'schedule' ? 'schedule' : action.triggerKind
if (!key) throw new Error('Missing trigger kind')
// after
const key = action.resource === 'schedule' ? 'schedule' : action.triggerKind
if (!key) {
  sendUserToast('Cannot open drawer: unknown trigger kind', true)
  return
}
Defensive patterns

Strategy: validation

Validate before calling

if (action.type === 'open_created_resource' && action.resource !== 'schedule' && !action.triggerKind) { sendUserToast('Action missing trigger kind', true); return }

Type guard

function hasTriggerKind(a: ToolDisplayAction): a is ToolDisplayAction & { triggerKind: string } { return typeof (a as any).triggerKind === 'string' && (a as any).triggerKind.length > 0 }

Try / catch

try { await openCreatedResource(action) } catch (e) { sendUserToast(String(e.message), true) }

Prevention

When it happens

Trigger: A tool action of type 'open_created_resource' arrives with action.resource neither 'schedule' nor undefined-mapped, and action.triggerKind is undefined/null/empty — typically a trigger-producing tool that did not populate triggerKind in its action payload.

Common situations: A newly added AI tool emits open_created_resource actions for a trigger kind the drawer map does not know (e.g. a new native trigger type) or forgets to set triggerKind; older chat transcripts replaying actions recorded before the field existed.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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