{"record":{"id":"a915b9b37627cc1a","repo":"Zie619/n8n-workflows","slug":"invalid-action","errorCode":null,"errorMessage":"Invalid action","messagePattern":"Invalid action","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"workflows/Code/0926_Code_Webhook_Create_Webhook.json","lineNumber":1703,"sourceCode":"              \"type\": \"string\",\n              \"value\": \"={{ new Date().toISOString() }}\"\n            }\n          ]\n        }\n      },\n      \"typeVersion\": 3.4,\n      \"notes\": \"This set node performs automated tasks as part of the workflow.\"\n    },\n    {\n      \"id\": \"6749923b-1032-4adb-b805-eda6efd5ee1c\",\n      \"name\": \"Verify Approval Data\",\n      \"type\": \"n8n-nodes-base.code\",\n      \"position\": [\n        6340,\n        4060\n      ],\n      \"parameters\": {\n        \"jsCode\": \"const input = $input.all()[0].json;\\nif (!input[\\\"Submission ID\\\"]) throw new Error(\\\"Submission ID is missing\\\");\\nif (![\\\"approve\\\", \\\"reject\\\"].includes(input[\\\"Action\\\"])) throw new Error(\\\"Invalid action\\\");\\nif (input[\\\"Action\\\"] === \\\"approve\\\" && input[\\\"Approved Quantity\\\"] <= 0) throw new Error(\\\"Approved quantity must be greater than 0\\\");\\nreturn { json: input };\"\n      },\n      \"typeVersion\": 2,\n      \"notes\": \"This code node performs automated tasks as part of the workflow.\"\n    },\n    {\n      \"id\": \"c5e34da4-81ec-47dc-aacf-4d6e0cf4256c\",\n      \"name\": \"Retrieve Issue Request Details\",\n      \"type\": \"n8n-nodes-base.googleSheets\",\n      \"position\": [\n        6560,\n        3840\n      ],\n      \"parameters\": {\n        \"options\": {},\n        \"filtersUI\": {\n          \"values\": [\n            {\n              \"lookupValue\": \"={{ $json[\\\"Submission ID\\\"] }}\",","sourceCodeStart":1685,"sourceCodeEnd":1721,"githubUrl":"https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Code/0926_Code_Webhook_Create_Webhook.json#L1685-L1721","documentation":"Thrown by 'Verify Approval Data' when `Action` is not exactly 'approve' or 'reject' (case-sensitive). The approval webhook must carry one of these two literal values; anything else - 'Approve', 'approved', 'yes', undefined - fails the includes() check.","triggerScenarios":"Approval form sends a different label or capitalized value; Action field missing from the payload; the form was edited to add options like 'hold' or 'return'; email-link based approval encoding the action differently (e.g. 'a'/'r').","commonSituations":"Form option labels changed after the workflow was built; case mismatch between form values and workflow expectations; new intermediate states added without updating this validator.","solutions":["Normalize case and trim before validating: input['Action']?.trim().toLowerCase().","Pin the approval form's allowed values to exactly approve/reject (radio or dropdown, not free text).","If new actions are legitimate, extend the allowlist and add handling branches for them.","Echo the received value in the error so mismatches are obvious."],"exampleFix":"// before\nif (![\"approve\", \"reject\"].includes(input[\"Action\"])) throw new Error(\"Invalid action\");\n\n// after\nconst action = typeof input[\"Action\"] === 'string' ? input[\"Action\"].trim().toLowerCase() : '';\nif (![\"approve\", \"reject\"].includes(action)) {\n  throw new Error(`Invalid action: ${JSON.stringify(input[\"Action\"])} - must be 'approve' or 'reject'`);\n}","handlingStrategy":"validation","validationCode":"const action = typeof input['Action'] === 'string' ? input['Action'].trim().toLowerCase() : '';\nif (!['approve', 'reject'].includes(action)) {\n  throw new Error(`Invalid action: ${JSON.stringify(input['Action'])} - must be 'approve' or 'reject'`);\n}","typeGuard":"const isApprovalAction = (v) =>\n  typeof v === 'string' && ['approve', 'reject'].includes(v.trim().toLowerCase());","tryCatchPattern":null,"preventionTips":["Normalize case and whitespace before the allowlist check","Use a fixed dropdown/radio (approve|reject) in the approval form","Echo the received value in the error","When adding new actions, update the allowlist and routing together"],"tags":["n8n","webhook","approval-flow","enum-validation","case-sensitivity"],"backgroundTag":null,"analyzedSha":"94007c1445d9258a7da116646b79473e7c7c3282","analyzedAt":"2026-08-15T04:10:37.591Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}