{"record":{"id":"a8c24fb09402db3b","repo":"n8n-io/n8n","slug":"unsupported-syntax-assignment-operator-node-o","errorCode":null,"errorMessage":"Unsupported syntax: 'Assignment operator '${node.operator}' is not allowed. Only '=' is permitted.' is not allowed in SDK code","messagePattern":"Unsupported syntax: 'Assignment operator '(.+?)' is not allowed\\. Only '=' is permitted\\.' 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":698,"sourceCode":"\t\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Visit a conditional expression (ternary).\n\t */\n\tprivate visitConditionalExpression(node: ESTree.ConditionalExpression): unknown {\n\t\tconst test = this.evaluate(node.test);\n\t\treturn test ? this.evaluate(node.consequent) : this.evaluate(node.alternate);\n\t}\n\n\t/**\n\t * Visit an assignment expression.\n\t * Only allows simple property assignment (obj.prop = value).\n\t */\n\tprivate visitAssignmentExpression(node: ESTree.AssignmentExpression): unknown {\n\t\tif (node.operator !== '=') {\n\t\t\tthrow new UnsupportedNodeError(\n\t\t\t\t`Assignment operator '${node.operator}' is not allowed. Only '=' is permitted.`,\n\t\t\t\tnode.loc ?? undefined,\n\t\t\t\tthis.sourceCode,\n\t\t\t);\n\t\t}\n\n\t\tif (node.left.type !== 'MemberExpression') {\n\t\t\tthrow new UnsupportedNodeError(\n\t\t\t\t'Only property assignment (e.g., obj.prop = value) is allowed. Variable reassignment is not permitted.',\n\t\t\t\tnode.loc ?? undefined,\n\t\t\t\tthis.sourceCode,\n\t\t\t);\n\t\t}\n\n\t\tvalidateMemberExpression(node.left, this.sourceCode);\n\n\t\tif (node.left.object.type === 'Super') {\n\t\t\tthrow new UnsupportedNodeError(","sourceCodeStart":680,"sourceCodeEnd":716,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/workflow-sdk/src/ast-interpreter/interpreter.ts#L680-L716","documentation":"The interpreter only permits simple `=` assignment. Compound assignment operators (`+=`, `-=`, `*=`, `/=`, `%=`, `**=`, `&&=`, `||=`, `??=`, and all bitwise variants) are rejected at interpreter.ts:697 because they combine read-modify-write semantics that the sandbox doesn't track — they would need to read the current binding value, which conflicts with the `const`-only, no-reassignment model.","triggerScenarios":"Writing `obj.count += 1`, `x *= 2`, `y ??= defaultValue`, or any compound assignment in SDK code. The check `node.operator !== '='` at interpreter.ts:697 catches all compound operators before the left-hand-side type check.","commonSituations":"Accumulating counters; building up string values; porting imperative JS that uses `+=` for aggregation; shorthand patterns from Code-node JS.","solutions":["Expand to explicit form: `obj.prop = obj.prop + 1` instead of `obj.prop += 1`","Use a new `const` with the computed value: `const total = base + 1`","Move accumulator logic to a Code node if the pattern is complex"],"exampleFix":"// before\nobj.count += 1;\n\n// after\nobj.count = obj.count + 1;","handlingStrategy":"validation","validationCode":"// Detect compound assignment operators\nconst COMPOUND_OPS = new Set(['+=','-=','*=','/=','%=','**=','<<=','>>=','>>>=','&=','|=','^=','&&=','||=','??=']);\n\nfunction hasCompoundAssignment(code: string): string[] {\n  const ast = parse(code, { ecmaVersion: 'latest', sourceType: 'module' });\n  const found: string[] = [];\n  walk(ast, (node) => {\n    if (node.type === 'AssignmentExpression' && COMPOUND_OPS.has(node.operator)) {\n      found.push(node.operator);\n    }\n  });\n  return found;\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('Assignment operator')) {\n    // suggest expanding to explicit form: obj.prop = obj.prop + value\n  }\n  throw e;\n}","preventionTips":["Only `=` is allowed for assignment","Expand `x += 1` to `x = x + 1` (but only if x is a property, not a variable)","Move complex accumulators to a Code node"],"tags":["sdk-interpreter","assignment","compound-operator"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}