{"record":{"id":"ca51d3125ea457a6","repo":"windmill-labs/windmill","slug":"invalid-config-for-a-parsed-kind-trigger-cal","errorCode":null,"errorMessage":"Invalid config for a \"${parsed.kind}\" trigger. Call get_trigger_schema with kind \"${parsed.kind}\" for its exact fields. Issues: ${config.error.issues.map((i) => `${i.path.join('.') || '<root>'}: ${i.message}`).join('; ')}","messagePattern":"Invalid config for a \"(.+?)\" trigger\\. Call get_trigger_schema with kind \"(.+?)\" for its exact fields\\. Issues: (.+?): (.+?)`\\)\\.join\\('; '\\)\\}","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/global/core.ts","lineNumber":3578,"sourceCode":"\t{\n\t\tdef: createToolDef(\n\t\t\twriteTriggerSchema,\n\t\t\t'write_trigger',\n\t\t\t'Create or overwrite a draft trigger.',\n\t\t\t{ strict: false }\n\t\t),\n\t\tshowDetails: true,\n\t\tstreamArguments: true,\n\t\tshowFade: true,\n\t\tfn: async (ctx) => {\n\t\t\tconst parsed = writeTriggerSchema.parse(ctx.args)\n\t\t\t// writeTriggerDraft dispatches on `kind`, so a config belonging to another kind\n\t\t\t// has to be rejected here rather than reaching the API as a corrupt draft. The\n\t\t\t// recovery instruction leads because formatToolError caps the message at 2k and\n\t\t\t// a long issue list would otherwise push it out of what the model receives.\n\t\t\tconst config = triggerRequestSchemas[parsed.kind].safeParse(parsed.config)\n\t\t\tif (!config.success) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid config for a \"${parsed.kind}\" trigger. Call get_trigger_schema with kind \"${parsed.kind}\" for its exact fields. Issues: ${config.error.issues\n\t\t\t\t\t\t.map((i) => `${i.path.join('.') || '<root>'}: ${i.message}`)\n\t\t\t\t\t\t.join('; ')}`\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn writeTriggerDraft({ ...parsed, config: config.data }, ctx)\n\t\t}\n\t},\n\t{\n\t\tdef: createToolDef(\n\t\t\tgetTriggerSchemaSchema,\n\t\t\t'get_trigger_schema',\n\t\t\t'Get the configuration schema for one trigger kind. Call before write_trigger.'\n\t\t),\n\t\tplanModeSafe: true,\n\t\tfn: async (ctx) => {\n\t\t\tconst { kind } = getTriggerSchemaSchema.parse(ctx.args)\n\t\t\treturn triggerConfigJsonSchema(kind)","sourceCodeStart":3560,"sourceCodeEnd":3596,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/global/core.ts#L3560-L3596","documentation":"After parsing the overall write_trigger args, the per-kind config is validated with triggerRequestSchemas[kind]. If the config does not match the schema for the declared kind, this error lists the zod issue paths and messages and directs the model to get_trigger_schema for the exact fields.","triggerScenarios":"A write_trigger tool call passes a config whose shape fails safeParse for parsed.kind — e.g. a websocket trigger config missing its filters, or config fields belonging to a different trigger kind.","commonSituations":"The model mixes field sets between trigger kinds (e.g. email fields in a webhook trigger), omits required fields, or misspells option names.","solutions":["Call get_trigger_schema with the same kind to get the exact field list","Fix the config fields per the listed issue paths and retry write_trigger","Verify the kind matches the config you are actually passing"],"exampleFix":"// before\nwriteTrigger({ kind: 'websocket', config: { path: 'x', email: 'a@b.c' } })\n// after\nwriteTrigger({ kind: 'websocket', config: { path: 'x', filters: [] } })","handlingStrategy":"validation","validationCode":"const config = triggerRequestSchemas[kind].safeParse(parsed.config);\nif (!config.success) {\n  console.log(config.error.issues.map(i => `${i.path.join('.')}: ${i.message}`));\n  throw new Error('fix config before writing trigger');\n}","typeGuard":"function configMatchesKind(kind, config) { return triggerRequestSchemas[kind].safeParse(config).success; }","tryCatchPattern":"try { writeTrigger(args) } catch (e) { if (e.message.includes('Invalid config')) await getTriggerSchema(kind) and retry; }","preventionTips":["Call get_trigger_schema for the kind before composing config","Never reuse config shapes across trigger kinds","Check zod issue paths in the error message"],"tags":["ai-copilot","schema-validation","trigger","zod"],"backgroundTag":"schema-validation-failed","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"}