{"record":{"id":"aff17403470a2635","repo":"windmill-labs/windmill","slug":"trigger-kind-is-required-when-type-is-trigger","errorCode":null,"errorMessage":"trigger_kind is required when type is trigger.","messagePattern":"trigger_kind is required when type is trigger\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/global/core.ts","lineNumber":1982,"sourceCode":"\t\t\t\tworkspace,\n\t\t\t\tpath,\n\t\t\t\tgetDraft: !deployedOnly\n\t\t\t})\n\t\t\tconst draft = deployedOnly ? undefined : (script.draft as Script | undefined)\n\t\t\treturn scriptToItem(draft ?? script, true)\n\t\t}\n\t\tcase 'flow': {\n\t\t\t// Prefer the DB draft (newer than the deployed version) when one exists,\n\t\t\t// unless the caller explicitly asked for the deployed state.\n\t\t\tconst flow = await FlowService.getFlowByPath({ workspace, path, getDraft: !deployedOnly })\n\t\t\tconst draft = deployedOnly ? undefined : (flow.draft as Flow | undefined)\n\t\t\treturn flowToItem(draft ?? flow, true)\n\t\t}\n\t\tcase 'schedule':\n\t\t\treturn scheduleToItem(await ScheduleService.getSchedule({ workspace, path }), true)\n\t\tcase 'trigger':\n\t\t\tif (!triggerKind) {\n\t\t\t\tthrow new Error('trigger_kind is required when type is trigger.')\n\t\t\t}\n\t\t\treturn triggerToItem(\n\t\t\t\ttriggerKind,\n\t\t\t\tawait triggerServices[triggerKind].get({ workspace, path }),\n\t\t\t\ttrue\n\t\t\t)\n\t\tcase 'resource':\n\t\t\treturn resourceToItem(await ResourceService.getResource({ workspace, path }), true)\n\t\tcase 'variable':\n\t\t\t// Never expose the value, even when read directly. Pass decryptSecret=false\n\t\t\t// to avoid materializing secret values server-side.\n\t\t\treturn variableToItem(\n\t\t\t\tawait VariableService.getVariable({ workspace, path, decryptSecret: false })\n\t\t\t)\n\t\tcase 'app': {\n\t\t\t// Returns lightweight metadata only — file/runnable contents come via read_app_file.\n\t\t\tconst app = await AppService.getAppByPath({ workspace, path })\n\t\t\tconst value = appSourceToDraftValue(app)","sourceCodeStart":1964,"sourceCodeEnd":2000,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/global/core.ts#L1964-L2000","documentation":"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.","triggerScenarios":"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).","commonSituations":"The model omits the kind discriminator when describing or fetching a trigger; schedules and flows carry enough info themselves but triggers do not.","solutions":["Add trigger_kind to the tool call with the trigger's actual kind","If the kind is unknown, list the app/flow triggers first to discover it, then retry with the kind"],"exampleFix":"// before\nreadItem({ type: 'trigger', path: 'u/admin/my_trigger' })\n// after\nreadItem({ type: 'trigger', path: 'u/admin/my_trigger', trigger_kind: 'websocket' })","handlingStrategy":"validation","validationCode":"if (type === 'trigger' && !triggerKind) throw new Error('trigger_kind required');\nawait readItem({ type, path, triggerKind });","typeGuard":"function canReadTrigger(args) { return args.type !== 'trigger' || typeof args.trigger_kind === 'string'; }","tryCatchPattern":"try { await readTrigger(args) } catch (e) { if (e.message.includes('trigger_kind is required')) retryWithKindDiscovered(); }","preventionTips":["Always supply trigger_kind when type is 'trigger'","Discover the kind via listing before reading"],"tags":["ai-copilot","missing-argument","trigger"],"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"}