{"record":{"id":"ad166f4c3bcb3f1b","repo":"windmill-labs/windmill","slug":"missing-trigger-kind","errorCode":null,"errorMessage":"Missing trigger kind","messagePattern":"Missing trigger kind","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/CreatedResourceActionDrawers.svelte","lineNumber":138,"sourceCode":"\n\tasync function openCreatedResource(action: ToolDisplayAction) {\n\t\tif (action.type !== 'open_created_resource') {\n\t\t\treturn\n\t\t}\n\n\t\tif (action.resource === 'resource') {\n\t\t\tawait resourceEditorDrawer?.initEdit(action.path)\n\t\t\treturn\n\t\t}\n\n\t\tif (action.resource === 'variable') {\n\t\t\tawait variableEditor?.editVariable(action.path)\n\t\t\treturn\n\t\t}\n\n\t\tconst key = action.resource === 'schedule' ? 'schedule' : action.triggerKind\n\t\tif (!key) {\n\t\t\tthrow new Error('Missing trigger kind')\n\t\t}\n\n\t\tif (activeDrawer?.key === key && activeDrawer.path === action.path && drawer?.isOpen()) {\n\t\t\tactiveDrawer = undefined\n\t\t\teditor = undefined\n\t\t\tdrawer.closeDrawer()\n\t\t\treturn\n\t\t}\n\n\t\tconst config = drawerConfigs[key]\n\t\tconst promise = activeDrawer?.key === key ? activeDrawer.promise : config.load()\n\t\tif (activeDrawer?.key !== key) {\n\t\t\teditor = undefined\n\t\t}\n\n\t\tconst request: ActiveDrawerState = {\n\t\t\tid: nextActiveDrawerId++,\n\t\t\tkey,","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/CreatedResourceActionDrawers.svelte#L120-L156","documentation":"openCreatedResource resolves which drawer to open via the action's key: schedules map to 'schedule', everything else uses action.triggerKind. If neither yields a value the action carries no usable drawer key, so it throws 'Missing trigger kind'.","triggerScenarios":"A tool action of type 'open_created_resource' arrives with action.resource neither 'schedule' nor undefined-mapped, and action.triggerKind is undefined/null/empty — typically a trigger-producing tool that did not populate triggerKind in its action payload.","commonSituations":"A newly added AI tool emits open_created_resource actions for a trigger kind the drawer map does not know (e.g. a new native trigger type) or forgets to set triggerKind; older chat transcripts replaying actions recorded before the field existed.","solutions":["Ensure the backend/tool sets action.triggerKind when emitting open_created_resource for trigger resources","Add the new trigger kind to drawerConfigs so it resolves to a drawer key","Guard the call: skip or toast when action.triggerKind is missing instead of throwing"],"exampleFix":"// before\nconst key = action.resource === 'schedule' ? 'schedule' : action.triggerKind\nif (!key) throw new Error('Missing trigger kind')\n// after\nconst key = action.resource === 'schedule' ? 'schedule' : action.triggerKind\nif (!key) {\n  sendUserToast('Cannot open drawer: unknown trigger kind', true)\n  return\n}","handlingStrategy":"validation","validationCode":"if (action.type === 'open_created_resource' && action.resource !== 'schedule' && !action.triggerKind) { sendUserToast('Action missing trigger kind', true); return }","typeGuard":"function hasTriggerKind(a: ToolDisplayAction): a is ToolDisplayAction & { triggerKind: string } { return typeof (a as any).triggerKind === 'string' && (a as any).triggerKind.length > 0 }","tryCatchPattern":"try { await openCreatedResource(action) } catch (e) { sendUserToast(String(e.message), true) }","preventionTips":["Always populate triggerKind when tools emit open_created_resource","Add new trigger kinds to drawerConfigs as part of the trigger feature","Validate action payloads at the tool boundary"],"tags":["svelte","triggers","missing-field"],"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"}