n8n-io/n8n · error · UnsupportedNodeError
Unsupported syntax: 'Dynamic method name' is not allowed in
Error message
Unsupported syntax: 'Dynamic method name' is not allowed in SDK code
What it means
In a method call `obj.method()`, the interpreter requires the method name to be statically resolvable — either a dot-access `Identifier` (`obj.add()`) or a string `Literal` key (`obj["add"]()`). Computed method names using a runtime expression (`obj[dynamicKey]()`) are rejected at interpreter.ts:245 because they could resolve to any property, defeating the method allowlist.
Source
Thrown at packages/@n8n/workflow-sdk/src/ast-interpreter/interpreter.ts:245
if (memberExpr.object.type === 'Super') {
throw new UnsupportedNodeError(
'super keyword is not supported in SDK code',
memberExpr.object.loc ?? undefined,
this.sourceCode,
);
}
// Get method name
let methodName: string;
if (memberExpr.property.type === 'Identifier') {
methodName = memberExpr.property.name;
} else if (
memberExpr.property.type === 'Literal' &&
typeof memberExpr.property.value === 'string'
) {
methodName = memberExpr.property.value;
} else {
throw new UnsupportedNodeError(
'Dynamic method name',
memberExpr.property.loc ?? undefined,
this.sourceCode,
);
}
// Handle safe global methods (e.g. JSON.stringify, JSON.parse)
// Must check before evaluating the object, since the global itself is blocked
if (memberExpr.object.type === 'Identifier') {
const safeMethod = getSafeJSONMethod(memberExpr.object.name, methodName);
if (safeMethod) {
const args = node.arguments.map((arg) => this.evaluate(arg));
return safeMethod(...args);
}
}
thisArg = this.evaluate(memberExpr.object);
View on GitHub (pinned to 5ac6606e81)
Solutions
- Use a static method name: `obj.add()` or `obj['add']()` (string literal is allowed)
- If dispatch is truly needed, use `ifElse` or `switchCase` SDK functions to branch to static calls
- Move the dynamic dispatch into a Code node
Example fix
// before
wf[methodName]({ name: 'X' });
// after
wf.add({ name: 'X' }); Defensive patterns
Strategy: validation
Validate before calling
// Detect computed method calls (obj[expr]() where expr is not a string literal)
function hasComputedMethod(code: string): boolean {
const ast = parse(code, { ecmaVersion: 'latest', sourceType: 'module' });
let found = false;
walk(ast, (node) => {
if (
node.type === 'CallExpression' &&
node.callee.type === 'MemberExpression' &&
node.callee.computed &&
node.callee.property.type !== 'Literal'
) {
found = true;
}
});
return found;
} Try / catch
import { UnsupportedNodeError } from '@n8n/workflow-sdk/ast-interpreter/errors';
try {
interpretSDKCode(sdkCode, sdkFunctions);
} catch (e) {
if (e instanceof UnsupportedNodeError && e.message.includes('Dynamic method name')) {
// instruct user to use static method names
}
throw e;
} Prevention
- Always use dot notation for method calls: `obj.add()` not `obj[key]()`
- If you need dispatch, branch with `ifElse`/`switchCase` to static calls
When it happens
Trigger: Writing `obj[methodName]()` or `obj[getKey()]()` where the bracket contains a non-literal expression. At interpreter.ts:237-250, the property must be an `Identifier` or a string `Literal`; anything else (a `CallExpression`, `MemberExpression`, `BinaryExpression`, etc.) triggers the throw.
Common situations: Dynamic dispatch patterns; selecting a builder method based on runtime data; porting code that uses computed method names for flexibility.
Related errors
- Unsupported syntax: 'Dynamic property access' is not allowed
- '${name}' is a reserved SDK function name and cannot be used
- Method '${methodName}' is not an allowed SDK method. Allowed
- Unsupported syntax: 'Object key type ${prop.key.type}' is no
- Dynamic property access is not allowed. Use static property
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/4dd129e4180601a8.
Report an issue: GitHub.