windmill-labs/windmill · error · Error

trigger_kind is required when type is trigger.

Error message

trigger_kind is required when type is trigger.

What it means

When reading an item of type 'trigger', the tool needs to know which trigger kind's service to query, since triggerServices is keyed by kind. This error is thrown when type='trigger' is requested without a trigger_kind argument.

Source

Thrown at frontend/src/lib/components/copilot/chat/global/core.ts:1982

				workspace,
				path,
				getDraft: !deployedOnly
			})
			const draft = deployedOnly ? undefined : (script.draft as Script | undefined)
			return scriptToItem(draft ?? script, true)
		}
		case 'flow': {
			// Prefer the DB draft (newer than the deployed version) when one exists,
			// unless the caller explicitly asked for the deployed state.
			const flow = await FlowService.getFlowByPath({ workspace, path, getDraft: !deployedOnly })
			const draft = deployedOnly ? undefined : (flow.draft as Flow | undefined)
			return flowToItem(draft ?? flow, true)
		}
		case 'schedule':
			return scheduleToItem(await ScheduleService.getSchedule({ workspace, path }), true)
		case 'trigger':
			if (!triggerKind) {
				throw new Error('trigger_kind is required when type is trigger.')
			}
			return triggerToItem(
				triggerKind,
				await triggerServices[triggerKind].get({ workspace, path }),
				true
			)
		case 'resource':
			return resourceToItem(await ResourceService.getResource({ workspace, path }), true)
		case 'variable':
			// Never expose the value, even when read directly. Pass decryptSecret=false
			// to avoid materializing secret values server-side.
			return variableToItem(
				await VariableService.getVariable({ workspace, path, decryptSecret: false })
			)
		case 'app': {
			// Returns lightweight metadata only — file/runnable contents come via read_app_file.
			const app = await AppService.getAppByPath({ workspace, path })
			const value = appSourceToDraftValue(app)

View on GitHub (pinned to e474e8803c)

Solutions

  1. Add trigger_kind to the tool call with the trigger's actual kind
  2. If the kind is unknown, list the app/flow triggers first to discover it, then retry with the kind

Example fix

// before
readItem({ type: 'trigger', path: 'u/admin/my_trigger' })
// after
readItem({ type: 'trigger', path: 'u/admin/my_trigger', trigger_kind: 'websocket' })
Defensive patterns

Strategy: validation

Validate before calling

if (type === 'trigger' && !triggerKind) throw new Error('trigger_kind required');
await readItem({ type, path, triggerKind });

Type guard

function canReadTrigger(args) { return args.type !== 'trigger' || typeof args.trigger_kind === 'string'; }

Try / catch

try { await readTrigger(args) } catch (e) { if (e.message.includes('trigger_kind is required')) retryWithKindDiscovered(); }

Prevention

When it happens

Trigger: A read/get tool call with type='trigger' and no triggerKind parameter (e.g. reading an existing trigger without specifying whether it's a websocket, email, etc. trigger).

Common situations: The model omits the kind discriminator when describing or fetching a trigger; schedules and flows carry enough info themselves but triggers do not.

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/aff17403470a2635. Report an issue: GitHub.