windmill-labs/windmill · error

trigger_kind is required when deleting a trigger.

Error message

trigger_kind is required when deleting a trigger.

What it means

Validation error thrown at the start of the chat's delete-draft tool handler. As with deploy, deleting a trigger requires the trigger_kind argument to locate the right draft record; a delete call for type 'trigger' without trigger_kind is rejected immediately before any status update or deletion happens. It enforces the tool's argument contract for the AI agent.

Source

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

			return triggerServices[triggerKind!].exists({ workspace, path })
		case 'resource':
			return ResourceService.existsResource({ workspace, path })
		case 'variable':
			return VariableService.existsVariable({ workspace, path })
		case 'app':
			return AppService.existsApp({ workspace, path })
	}
}

async function deleteWorkspaceItem(
	args: { type: WorkspaceItemType; path: string; trigger_kind?: TriggerKind },
	ctx: WriteDraftCtx
): Promise<string> {
	const { workspace, toolId, toolCallbacks } = ctx
	const { type, path, trigger_kind: triggerKind } = args

	if (type === 'trigger' && !triggerKind) {
		throw new Error('trigger_kind is required when deleting a trigger.')
	}

	toolCallbacks.setToolStatus(toolId, {
		content: `Deleting ${type} "${path}"...`
	})

	switch (type) {
		case 'script':
			await ScriptService.deleteScriptByPath({ workspace, path })
			break
		case 'flow':
			await FlowService.deleteFlowByPath({ workspace, path })
			break
		case 'schedule':
			await ScheduleService.deleteSchedule({ workspace, path })
			break
		case 'trigger':
			await triggerServices[triggerKind!].delete({ workspace, path })

View on GitHub (pinned to e474e8803c)

Solutions

  1. Retry the delete call including trigger_kind matching the trigger's kind.
  2. If invoking programmatically, add trigger_kind to the args.
  3. Look up the trigger in the editor to confirm its kind before deleting.

Example fix

// before
await deleteDraft({ type: 'trigger', path: 'u/hooks/ingest' })
// Error: trigger_kind is required when deleting a trigger.

// after
await deleteDraft({ type: 'trigger', path: 'u/hooks/ingest', trigger_kind: 'webhook' })
Defensive patterns

Strategy: validation

Validate before calling

if (args.type === 'trigger' && !args.trigger_kind) {
  throw new Error('delete: trigger_kind is required for triggers')
}
await deleteDraft(args)

Type guard

function hasTriggerKind(args) {
  return args.type !== 'trigger' || typeof args.trigger_kind === 'string' && args.trigger_kind.length > 0
}

Try / catch

try {
  await deleteDraft(args)
} catch (e) {
  if (/trigger_kind is required/.test(e.message)) {
    args.trigger_kind = resolveTriggerKind(args.path) // then retry
  } else throw e
}

Prevention

When it happens

Trigger: A delete tool call with args.type === 'trigger' and args.trigger_kind undefined/empty — usually the model omitting the field, or programmatic callers not forwarding the kind.

Common situations: An LLM emits a delete call missing trigger_kind; a wrapper tool (e.g. cleanup flows) builds delete args generically for all types and drops the trigger-specific field.

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