{"record":{"id":"17ea3e3237a392a9","repo":"windmill-labs/windmill","slug":"trigger-kind-is-required-when-deploying-a-trigger","errorCode":null,"errorMessage":"trigger_kind is required when deploying a trigger.","messagePattern":"trigger_kind is required when deploying a trigger\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/global/core.ts","lineNumber":7259,"sourceCode":"\t\ttype: WorkspaceItemType\n\t\tpath: string\n\t\ttrigger_kind?: TriggerKind\n\t\tdeployment_message?: string\n\t\tforce?: boolean\n\t},\n\tctx: WriteDraftCtx\n): Promise<string> {\n\tconst { workspace, toolId, toolCallbacks, sessionId } = ctx\n\tconst {\n\t\ttype,\n\t\tpath,\n\t\ttrigger_kind: triggerKind,\n\t\tdeployment_message: deploymentMessage,\n\t\tforce\n\t} = args\n\n\tif (type === 'trigger' && !triggerKind) {\n\t\tthrow new Error('trigger_kind is required when deploying a trigger.')\n\t}\n\n\tconst draft = await getGlobalDraft(workspace, type, path, triggerKind)\n\tif (!draft) {\n\t\tthrow new Error(`No draft found for ${type} \"${path}\".`)\n\t}\n\tif (draft.value === undefined) {\n\t\tthrow new Error(`Draft ${type} \"${path}\" has no value to deploy.`)\n\t}\n\n\ttoolCallbacks.setToolStatus(toolId, {\n\t\tcontent: `Deploying ${type} \"${path}\"...`\n\t})\n\n\tlet actions: ToolDisplayAction[] | undefined\n\t// Where the deploy actually lands — the app branch can resolve a different\n\t// target from the draft's own path fields; the mask rename below must track it.\n\tlet deployedPath = path","sourceCodeStart":7241,"sourceCodeEnd":7277,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/global/core.ts#L7241-L7277","documentation":"Validation error thrown at the top of the chat's deployDraft tool. Trigger items exist in several kinds (webhook, schedule-like native triggers, etc.), and getGlobalDraft needs the trigger_kind to locate the right draft. If the deploying tool call has type 'trigger' but no trigger_kind argument, the tool refuses before doing any work. It is a strict argument-contract error for the AI agent's tool schema.","triggerScenarios":"A deploy tool call with args.type === 'trigger' and args.trigger_kind undefined or empty — typically because the model omitted the trigger_kind parameter or the calling UI/CLI built the args without it.","commonSituations":"An LLM emits a deploy tool call missing the optional-looking trigger_kind field; custom tooling invokes the deploy handler for a trigger without forwarding the kind; schema drift between tool definition versions.","solutions":["Retry the deploy tool call including trigger_kind (e.g. 'webhook', the kind the trigger was created with).","If you are driving the tool programmatically, add the trigger_kind field to the args object.","Check the trigger's definition in the editor to confirm which kind it is, then pass that exact kind."],"exampleFix":"// before\nawait deployDraft({ type: 'trigger', path: 'u/hooks/ingest', workspace: 'demo' })\n// Error: trigger_kind is required when deploying a trigger.\n\n// after\nawait deployDraft({ type: 'trigger', path: 'u/hooks/ingest', workspace: 'demo', trigger_kind: 'webhook' })","handlingStrategy":"validation","validationCode":"if (args.type === 'trigger' && !args.trigger_kind) {\n  throw new Error('deploy: trigger_kind is required for triggers')\n}\nawait deployDraft(args)","typeGuard":"function hasTriggerKind(args) {\n  return args.type !== 'trigger' || typeof args.trigger_kind === 'string' && args.trigger_kind.length > 0\n}","tryCatchPattern":"try {\n  await deployDraft(args)\n} catch (e) {\n  if (/trigger_kind is required/.test(e.message)) {\n    args.trigger_kind = resolveTriggerKind(args.path) // then retry\n  } else throw e\n}","preventionTips":["Always include trigger_kind when building deploy args for triggers.","Constrain the tool schema so trigger_kind is required for type 'trigger'.","Validate tool-call args against the schema before invoking the handler."],"tags":["validation","missing-argument","trigger","tool-call"],"backgroundTag":"missing-required-argument","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}