{"record":{"id":"716dbe1f9a329625","repo":"windmill-labs/windmill","slug":"invalid-native-trigger-path-change-path","errorCode":null,"errorMessage":"Invalid native trigger path: ${change.path}","messagePattern":"Invalid native trigger path: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/sync/sync.ts","lineNumber":6392,"sourceCode":"                    path: removeSuffix(target, \".gcp_trigger.json\"),\n                  });\n                  break;\n                case \"azure_trigger\":\n                  await wmill.deleteAzureTrigger({\n                    workspace: workspaceId,\n                    path: removeSuffix(target, \".azure_trigger.json\"),\n                  });\n                  break;\n                case \"email_trigger\":\n                  await wmill.deleteEmailTrigger({\n                    workspace: workspaceId,\n                    path: removeSuffix(target, \".email_trigger.json\"),\n                  });\n                  break;\n                case \"native_trigger\": {\n                  const triggerInfo = extractNativeTriggerInfo(change.path);\n                  if (!triggerInfo) {\n                    throw new Error(\n                      `Invalid native trigger path: ${change.path}`,\n                    );\n                  }\n                  await wmill.deleteNativeTrigger({\n                    workspace: workspaceId,\n                    serviceName: triggerInfo.serviceName as NativeServiceName,\n                    externalId: triggerInfo.externalId,\n                  });\n                  break;\n                }\n                case \"variable\": {\n                  const variablePath = removeSuffix(target, \".variable.json\");\n                  try {\n                    await wmill.deleteVariable({\n                      workspace: workspaceId,\n                      path: variablePath,\n                    });\n                  } catch (e: any) {","sourceCodeStart":6374,"sourceCodeEnd":6410,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/sync/sync.ts#L6374-L6410","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Rename the file back to the exact format {script_path}.{flow|script}.{external_id}.{service}_native_trigger.json","Verify the extension is lowercase .json or .yaml","Check the service segment contains only word characters (letters, digits, underscore)","Delete the trigger via the UI or `wmill` trigger commands instead, then re-sync"],"exampleFix":"// before\nu/admin/script.flow.12345.nextcloud-trigger.json\n// after\nu/admin/script.flow.12345.nextcloud_native_trigger.json","handlingStrategy":"validation","validationCode":"const NATIVE_RE = /^(.+)\\.(flow|script)\\.([^.]+)\\.(\\w+)_native_trigger\\.(json|yaml)$/;\nexport function isValidNativeTriggerPath(p: string): boolean {\n  return NATIVE_RE.test(p.replaceAll(\"\\\\\", \"/\"));\n}","typeGuard":null,"tryCatchPattern":"if (!isValidNativeTriggerPath(change.path)) {\n  console.warn(\"skipping malformed native trigger file\", change.path);\n} else {\n  await wmill.sync.delete(opts);\n}","preventionTips":["Never rename *_native_trigger.json files by hand","Keep service names to word characters in file names","Only lowercase .json/.yaml extensions","Delete triggers via CLI/UI, then sync pull"],"tags":["cli","sync","native-trigger","path-format"],"backgroundTag":"invalid-native-trigger-path","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"}