windmill-labs/windmill · error · Error

--kind is required. Valid kinds: ${TRIGGER_TYPES.join(", ")}

Error message

--kind is required. Valid kinds: ${TRIGGER_TYPES.join(", ")}

What it means

`wmill trigger new <path>` requires the --kind option to know which trigger template to write. If --kind is absent, the command throws immediately listing the valid kinds (TRIGGER_TYPES). It is a pure argument-validation error thrown before any file or API work.

Source

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

    azure_mode: "namespace_pull",
    scope_resource_id: "",
    subscription_name: "",
    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",
  });

View on GitHub (pinned to e474e8803c)

Solutions

  1. Re-run with --kind set to one of the listed types, e.g. `wmill trigger new u/admin/myscript --kind schedule`
  2. Check `wmill trigger new --help` for the valid kind list
  3. Fix the calling script to pass opts.kind

Example fix

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

Strategy: validation

Validate before calling

const TRIGGER_TYPES = ["http","websocket","schedule","kafka","nats","rabbitmq","sqs","email","nextcloud","gsheet","postgresql","mongodb","gtt","ghostscript"];
if (!opts.kind) throw new Error("pass --kind, one of " + TRIGGER_TYPES.join(", "));

Try / catch

try {
  await wmill.trigger.new(opts, path);
} catch (e) {
  if (String(e.message).startsWith("--kind is required")) {
    console.error("Usage: wmill trigger new <path> --kind <type>");
  }
}

Prevention

When it happens

Trigger: Calling `wmill trigger new u/admin/myscript` without --kind, or invoking newTrigger programmatically with an opts object missing the kind field.

Common situations: Skipped in interactive scripts, outdated shell aliases built before --kind existed, or copy-pasted commands with the flag dropped.

Related errors


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