{"record":{"id":"ee1d8b55814ce01a","repo":"n8n-io/n8n","slug":"unsupported-syntax-binary-operator-node-operat","errorCode":null,"errorMessage":"Unsupported syntax: 'Binary operator ${node.operator}' is not allowed in SDK code","messagePattern":"Unsupported syntax: 'Binary operator (.+?)' is not allowed in SDK code","errorType":"exception","errorClass":"UnsupportedNodeError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/workflow-sdk/src/ast-interpreter/interpreter.ts","lineNumber":653,"sourceCode":"\t\t\t\t// eslint-disable-next-line eqeqeq\n\t\t\t\treturn left == right;\n\t\t\tcase '!=':\n\t\t\t\t// eslint-disable-next-line eqeqeq\n\t\t\t\treturn left != right;\n\t\t\tcase '===':\n\t\t\t\treturn left === right;\n\t\t\tcase '!==':\n\t\t\t\treturn left !== right;\n\t\t\tcase '<':\n\t\t\t\treturn (left as number) < (right as number);\n\t\t\tcase '<=':\n\t\t\t\treturn (left as number) <= (right as number);\n\t\t\tcase '>':\n\t\t\t\treturn (left as number) > (right as number);\n\t\t\tcase '>=':\n\t\t\t\treturn (left as number) >= (right as number);\n\t\t\tdefault:\n\t\t\t\tthrow new UnsupportedNodeError(\n\t\t\t\t\t`Binary operator ${node.operator}`,\n\t\t\t\t\tnode.loc ?? undefined,\n\t\t\t\t\tthis.sourceCode,\n\t\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Visit a logical expression.\n\t */\n\tprivate visitLogicalExpression(node: ESTree.LogicalExpression): unknown {\n\t\tconst left = this.evaluate(node.left);\n\n\t\tswitch (node.operator) {\n\t\t\tcase '&&':\n\t\t\t\treturn left ? this.evaluate(node.right) : left;\n\t\t\tcase '||':\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- Implementing JS || semantics","sourceCodeStart":635,"sourceCodeEnd":671,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/workflow-sdk/src/ast-interpreter/interpreter.ts#L635-L671","documentation":"Binary operators are restricted to arithmetic (`+`, `-`, `*`, `/`, `%`, `**`) and comparison (`==`, `!=`, `===`, `!==`, `<`, `<=`, `>`, `>=`). Bitwise operators (`|`, `&`, `^`, `<<`, `>>`, `>>>`) and relational operators (`in`, `instanceof`) throw `UnsupportedNodeError` at interpreter.ts:653 because they are rarely needed for workflow construction and bitwise ops are a common obfuscation vector.","triggerScenarios":"Writing `a | b`, `x in obj`, `y instanceof Z`, `n << 2`, or any bitwise/relational binary operator in SDK code. The switch at interpreter.ts:618 only has cases for the thirteen allowed operators.","commonSituations":"Bitwise flag manipulation; `in` operator for property existence checks; `instanceof` for type testing; porting algorithmic or low-level JS.","solutions":["For `in` checks: use property access and compare: `obj.prop !== undefined` or `obj.prop != null`","For `instanceof`: use `typeof` (supported) or move to a Code node","For bitwise ops: move to a Code node or n8n expression"],"exampleFix":"// before\nconst hasName = 'name' in obj;\n\n// after\nconst hasName = obj.name !== undefined;","handlingStrategy":"validation","validationCode":"const ALLOWED_BINARY = new Set(['+','-','*','/','%','**','==','!=','===','!==','<','<=','>','>=']);\n\nfunction findBadBinaryOperators(code: string): string[] {\n  const ast = parse(code, { ecmaVersion: 'latest', sourceType: 'module' });\n  const bad: string[] = [];\n  walk(ast, (node) => {\n    if (node.type === 'BinaryExpression' && !ALLOWED_BINARY.has(node.operator)) {\n      bad.push(node.operator);\n    }\n  });\n  return bad;\n}","typeGuard":null,"tryCatchPattern":"import { UnsupportedNodeError } from '@n8n/workflow-sdk/ast-interpreter/errors';\n\ntry {\n  interpretSDKCode(sdkCode, sdkFunctions);\n} catch (e) {\n  if (e instanceof UnsupportedNodeError && e.message.includes('Binary operator')) {\n    // show allowed operators and suggest property-access alternatives for `in`\n  }\n  throw e;\n}","preventionTips":["Allowed binary operators: arithmetic (`+`,`-`,`*`,`/`,`%`,`**`) and comparison (`==`,`!=`,`===`,`!==`,`<`,`<=`,`>`,`>=`)","No bitwise operators (`|`,`&`,`^`,`<<`,`>>`) — move to Code node","Replace `'key' in obj` with `obj.key !== undefined`"],"tags":["sdk-interpreter","binary-operator","bitwise","in-operator"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}