{"record":{"id":"835e0152a5cb7d40","repo":"windmill-labs/windmill","slug":"trigger-kind-is-required-when-deleting-a-trigger","errorCode":null,"errorMessage":"trigger_kind is required when deleting a trigger.","messagePattern":"trigger_kind is required when deleting a trigger\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/global/core.ts","lineNumber":7689,"sourceCode":"\t\t\treturn triggerServices[triggerKind!].exists({ workspace, path })\n\t\tcase 'resource':\n\t\t\treturn ResourceService.existsResource({ workspace, path })\n\t\tcase 'variable':\n\t\t\treturn VariableService.existsVariable({ workspace, path })\n\t\tcase 'app':\n\t\t\treturn AppService.existsApp({ workspace, path })\n\t}\n}\n\nasync function deleteWorkspaceItem(\n\targs: { type: WorkspaceItemType; path: string; trigger_kind?: TriggerKind },\n\tctx: WriteDraftCtx\n): Promise<string> {\n\tconst { workspace, toolId, toolCallbacks } = ctx\n\tconst { type, path, trigger_kind: triggerKind } = args\n\n\tif (type === 'trigger' && !triggerKind) {\n\t\tthrow new Error('trigger_kind is required when deleting a trigger.')\n\t}\n\n\ttoolCallbacks.setToolStatus(toolId, {\n\t\tcontent: `Deleting ${type} \"${path}\"...`\n\t})\n\n\tswitch (type) {\n\t\tcase 'script':\n\t\t\tawait ScriptService.deleteScriptByPath({ workspace, path })\n\t\t\tbreak\n\t\tcase 'flow':\n\t\t\tawait FlowService.deleteFlowByPath({ workspace, path })\n\t\t\tbreak\n\t\tcase 'schedule':\n\t\t\tawait ScheduleService.deleteSchedule({ workspace, path })\n\t\t\tbreak\n\t\tcase 'trigger':\n\t\t\tawait triggerServices[triggerKind!].delete({ workspace, path })","sourceCodeStart":7671,"sourceCodeEnd":7707,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/global/core.ts#L7671-L7707","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry the delete call including trigger_kind matching the trigger's kind.","If invoking programmatically, add trigger_kind to the args.","Look up the trigger in the editor to confirm its kind before deleting."],"exampleFix":"// before\nawait deleteDraft({ type: 'trigger', path: 'u/hooks/ingest' })\n// Error: trigger_kind is required when deleting a trigger.\n\n// after\nawait deleteDraft({ type: 'trigger', path: 'u/hooks/ingest', trigger_kind: 'webhook' })","handlingStrategy":"validation","validationCode":"if (args.type === 'trigger' && !args.trigger_kind) {\n  throw new Error('delete: trigger_kind is required for triggers')\n}\nawait deleteDraft(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 deleteDraft(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":["Include trigger_kind in every trigger delete call.","Share one args-builder for deploy/delete so the trigger_kind requirement is enforced once.","Validate tool-call args before invoking the delete 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"}