windmill-labs/windmill · error · Error

Invalid native trigger path: ${change.path}

Error message

Invalid native trigger path: ${change.path}

What it means

During `wmill sync delete`, native trigger files must follow the pattern {script_path}.{flow|script}.{external_id}.{service}_native_trigger.json. `extractNativeTriggerInfo` returns null when the path does not match, and the delete flow throws this error instead of guessing. It protects the CLI from deleting the wrong remote object.

Source

Thrown at cli/src/commands/sync/sync.ts:6392

                    path: removeSuffix(target, ".gcp_trigger.json"),
                  });
                  break;
                case "azure_trigger":
                  await wmill.deleteAzureTrigger({
                    workspace: workspaceId,
                    path: removeSuffix(target, ".azure_trigger.json"),
                  });
                  break;
                case "email_trigger":
                  await wmill.deleteEmailTrigger({
                    workspace: workspaceId,
                    path: removeSuffix(target, ".email_trigger.json"),
                  });
                  break;
                case "native_trigger": {
                  const triggerInfo = extractNativeTriggerInfo(change.path);
                  if (!triggerInfo) {
                    throw new Error(
                      `Invalid native trigger path: ${change.path}`,
                    );
                  }
                  await wmill.deleteNativeTrigger({
                    workspace: workspaceId,
                    serviceName: triggerInfo.serviceName as NativeServiceName,
                    externalId: triggerInfo.externalId,
                  });
                  break;
                }
                case "variable": {
                  const variablePath = removeSuffix(target, ".variable.json");
                  try {
                    await wmill.deleteVariable({
                      workspace: workspaceId,
                      path: variablePath,
                    });
                  } catch (e: any) {

View on GitHub (pinned to e474e8803c)

Solutions

  1. Rename the file back to the exact format {script_path}.{flow|script}.{external_id}.{service}_native_trigger.json
  2. Verify the extension is lowercase .json or .yaml
  3. Check the service segment contains only word characters (letters, digits, underscore)
  4. Delete the trigger via the UI or `wmill` trigger commands instead, then re-sync

Example fix

// before
u/admin/script.flow.12345.nextcloud-trigger.json
// after
u/admin/script.flow.12345.nextcloud_native_trigger.json
Defensive patterns

Strategy: validation

Validate before calling

const NATIVE_RE = /^(.+)\.(flow|script)\.([^.]+)\.(\w+)_native_trigger\.(json|yaml)$/;
export function isValidNativeTriggerPath(p: string): boolean {
  return NATIVE_RE.test(p.replaceAll("\\", "/"));
}

Try / catch

if (!isValidNativeTriggerPath(change.path)) {
  console.warn("skipping malformed native trigger file", change.path);
} else {
  await wmill.sync.delete(opts);
}

Prevention

When it happens

Trigger: `wmill sync delete` (or a push/remove path reusing this code) processes a change under a native-trigger directory whose filename was renamed, hand-edited, or truncated so the regex /^(.+)\.(flow|script)\.([^.]+)\.(\w+)_native_trigger$/ no longer matches.

Common situations: Manually renaming the file to shorten it, editing the external_id segment, OS case changes (`.JSON`), or a service name containing characters outside \w (dashes) breaking the match.

Related errors


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