n8n-io/n8n · error · UnsupportedNodeError
Unsupported syntax: 'Logical operator ${String(node.operator
Error message
Unsupported syntax: 'Logical operator ${String(node.operator)}' is not allowed in SDK code What it means
The interpreter supports the three JavaScript logical operators: `&&`, `||`, and `??` (nullish coalescing). Since these are the only logical operators in the language, the `default` case at interpreter.ts:676 is effectively unreachable through standard parsing — it exists as a defensive guard for malformed AST nodes or future language extensions.
Source
Thrown at packages/@n8n/workflow-sdk/src/ast-interpreter/interpreter.ts:676
}
}
/**
* Visit a logical expression.
*/
private visitLogicalExpression(node: ESTree.LogicalExpression): unknown {
const left = this.evaluate(node.left);
switch (node.operator) {
case '&&':
return left ? this.evaluate(node.right) : left;
case '||':
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- Implementing JS || semantics
return left ? left : this.evaluate(node.right);
case '??':
return left ?? this.evaluate(node.right);
default:
throw new UnsupportedNodeError(
`Logical operator ${String(node.operator)}`,
node.loc ?? undefined,
this.sourceCode,
);
}
}
/**
* Visit a conditional expression (ternary).
*/
private visitConditionalExpression(node: ESTree.ConditionalExpression): unknown {
const test = this.evaluate(node.test);
return test ? this.evaluate(node.consequent) : this.evaluate(node.alternate);
}
/**
* Visit an assignment expression.
* Only allows simple property assignment (obj.prop = value).View on GitHub (pinned to 5ac6606e81)
Solutions
- This error should not occur with valid JS — verify the parser and AST source
- If extending the interpreter: add the new operator to the `visitLogicalExpression` switch
- Simplify to standard `&&`, `||`, or `??` operators
Defensive patterns
Strategy: try-catch
Validate before calling
// Not user-validatable — all standard logical operators are supported. // If encountered, the AST is malformed or non-standard.
Try / catch
import { UnsupportedNodeError } from '@n8n/workflow-sdk/ast-interpreter/errors';
try {
interpretSDKCode(sdkCode, sdkFunctions);
} catch (e) {
if (e instanceof UnsupportedNodeError && e.message.includes('Logical operator')) {
// log as internal/parser issue — standard JS should never trigger this
}
throw e;
} Prevention
- Use only `&&`, `||`, and `??` — these are all standard logical operators
- This error is effectively unreachable with valid JavaScript
- If encountered, verify the parser configuration and AST integrity
When it happens
Trigger: Unreachable through valid JavaScript — all standard logical operators (`&&`, `||`, `??`) have cases in the switch at interpreter.ts:667. Could only fire with a non-standard or malformed AST node of type `LogicalExpression` with an unknown operator.
Common situations: Internal development or parser extensions; extremely unlikely in production. Not a user-fixable syntax issue.
Related errors
- Unsupported syntax: 'super keyword is not supported in SDK c
- Failed to decode base64 attachment data
- Unsupported syntax: 'Destructuring in variable declaration'
- '${name}' is a reserved SDK function name and cannot be used
- Expression nesting too deep (possible cycle in method chain)
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/b6c52f589a5c53ef.
Report an issue: GitHub.