{"record":{"id":"77dd2d86e5ea0210","repo":"windmill-labs/windmill","slug":"invalid-trigger-kind-opts-kind-valid-kinds","errorCode":null,"errorMessage":"Invalid trigger kind: ${opts.kind}. Valid kinds: ${TRIGGER_TYPES.join(\", \")}","messagePattern":"Invalid trigger kind: (.+?)\\. Valid kinds: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/trigger/trigger.ts","lineNumber":439,"sourceCode":"    enabled: false,\n  },\n  email: {\n    script_path: \"\",\n    is_flow: false,\n    local_part: \"\",\n    enabled: false,\n  },\n};\n\nasync function newTrigger(opts: GlobalOptions & { kind: string }, path: string) {\n  if (!validatePath(path)) {\n    return;\n  }\n  if (!opts.kind) {\n    throw new Error(\"--kind is required. Valid kinds: \" + TRIGGER_TYPES.join(\", \"));\n  }\n  if (!checkIfValidTrigger(opts.kind)) {\n    throw new Error(\"Invalid trigger kind: \" + opts.kind + \". Valid kinds: \" + TRIGGER_TYPES.join(\", \"));\n  }\n  const kind: TriggerType = opts.kind;\n  const filePath = `${path}.${kind}_trigger.yaml`;\n  try {\n    await stat(filePath);\n    throw new Error(\"File already exists: \" + filePath);\n  } catch (e: any) {\n    if (e.message?.startsWith(\"File already exists\")) throw e;\n  }\n  const template = triggerTemplates[kind];\n  await mkdir(dirname(filePath), { recursive: true });\n  await writeFile(filePath, yamlStringify(template), {\n    flag: \"wx\",\n    encoding: \"utf-8\",\n  });\n  log.info(colors.green(`Created ${filePath}`));\n}\n","sourceCodeStart":421,"sourceCodeEnd":457,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/trigger/trigger.ts#L421-L457","documentation":"`wmill trigger new <path> --kind <kind>` validates the kind against the known trigger types via checkIfValidTrigger. An unrecognized kind throws this error listing valid values. Unlike error 156, --kind was supplied but is not one the CLI supports.","triggerScenarios":"Running `wmill trigger new path --kind webhook` (or any misspelled/unsupported kind), or a CLI version older than a newly introduced trigger type being used with that new kind name.","commonSituations":"Typos (scedule), singular/plural mistakes, kinds that exist server-side but not in the installed CLI version, or EE-only kinds on an OSS CLI.","solutions":["Correct the kind spelling to one listed in the message or `wmill trigger new --help`","Upgrade the CLI (`npm i -g windmill-cli` / brew upgrade) if the kind is newly added","Use the Windmill UI to create the trigger if the kind isn't available in your CLI/edition"],"exampleFix":"// before\nwmill trigger new u/admin/s --kind schedul\n// after\nwmill trigger new u/admin/s --kind schedule","handlingStrategy":"validation","validationCode":"const VALID = new Set([\"http\",\"websocket\",\"schedule\",\"kafka\",\"nats\",\"rabbitmq\",\"sqs\",\"email\",\"nextcloud\",\"gsheet\",\"postgresql\",\"mongodb\",\"gtt\",\"ghostscript\"]);\nif (!VALID.has(opts.kind)) throw new Error(\"bad kind: \" + opts.kind);","typeGuard":"function isValidTriggerKind(k: string): k is TriggerType {\n  return TRIGGER_TYPES.includes(k as TriggerType);\n}","tryCatchPattern":"try {\n  await wmill.trigger.new(opts, path);\n} catch (e) {\n  if (String(e.message).startsWith(\"Invalid trigger kind\")) {\n    console.error(\"Use one of:\", String(e.message).split(\"Valid kinds: \")[1]);\n  }\n}","preventionTips":["Source the kind list from TRIGGER_TYPES, not hardcoded strings","Upgrade the CLI when adopting newly released trigger kinds","Validate interpolated --kind values in wrapper scripts"],"tags":["cli","trigger","invalid-argument","validation"],"backgroundTag":"invalid-enum-value","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"}