windmill-labs/windmill · error · Error

Invalid trigger kind: ${opts.kind}. Valid kinds: ${TRIGGER_T

Error message

Invalid trigger kind: ${opts.kind}. Valid kinds: ${TRIGGER_TYPES.join(", ")}

What it means

`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.

Source

Thrown at cli/src/commands/trigger/trigger.ts:439

    enabled: false,
  },
  email: {
    script_path: "",
    is_flow: false,
    local_part: "",
    enabled: false,
  },
};

async function newTrigger(opts: GlobalOptions & { kind: string }, path: string) {
  if (!validatePath(path)) {
    return;
  }
  if (!opts.kind) {
    throw new Error("--kind is required. Valid kinds: " + TRIGGER_TYPES.join(", "));
  }
  if (!checkIfValidTrigger(opts.kind)) {
    throw new Error("Invalid trigger kind: " + opts.kind + ". Valid kinds: " + TRIGGER_TYPES.join(", "));
  }
  const kind: TriggerType = opts.kind;
  const filePath = `${path}.${kind}_trigger.yaml`;
  try {
    await stat(filePath);
    throw new Error("File already exists: " + filePath);
  } catch (e: any) {
    if (e.message?.startsWith("File already exists")) throw e;
  }
  const template = triggerTemplates[kind];
  await mkdir(dirname(filePath), { recursive: true });
  await writeFile(filePath, yamlStringify(template), {
    flag: "wx",
    encoding: "utf-8",
  });
  log.info(colors.green(`Created ${filePath}`));
}

View on GitHub (pinned to e474e8803c)

Solutions

  1. Correct the kind spelling to one listed in the message or `wmill trigger new --help`
  2. Upgrade the CLI (`npm i -g windmill-cli` / brew upgrade) if the kind is newly added
  3. Use the Windmill UI to create the trigger if the kind isn't available in your CLI/edition

Example fix

// before
wmill trigger new u/admin/s --kind schedul
// after
wmill trigger new u/admin/s --kind schedule
Defensive patterns

Strategy: validation

Validate before calling

const VALID = new Set(["http","websocket","schedule","kafka","nats","rabbitmq","sqs","email","nextcloud","gsheet","postgresql","mongodb","gtt","ghostscript"]);
if (!VALID.has(opts.kind)) throw new Error("bad kind: " + opts.kind);

Type guard

function isValidTriggerKind(k: string): k is TriggerType {
  return TRIGGER_TYPES.includes(k as TriggerType);
}

Try / catch

try {
  await wmill.trigger.new(opts, path);
} catch (e) {
  if (String(e.message).startsWith("Invalid trigger kind")) {
    console.error("Use one of:", String(e.message).split("Valid kinds: ")[1]);
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/77dd2d86e5ea0210. Report an issue: GitHub.