n8n-io/n8n · error · UnsupportedNodeError

Unsupported syntax: '${node.type}' is not allowed in SDK cod

Error message

Unsupported syntax: '${node.type}' is not allowed in SDK code

What it means

Thrown by validateNodeType when the AST node type is NOT in ALLOWED_NODE_TYPES and also not in FORBIDDEN_NODE_TYPES. This is a closed-world allowlist: any node type the interpreter has not explicitly allowed is rejected. Unlike 1144, there is no remediation string — only the raw node type is reported.

Source

Thrown at packages/@n8n/workflow-sdk/src/ast-interpreter/validators.ts:271

	AwaitExpression: 'Await expressions are not allowed in SDK code',
	YieldExpression: 'Yield expressions are not allowed in SDK code',
};

/**
 * Check if a node type is allowed.
 * @throws UnsupportedNodeError if the node type is not allowed
 */
export function validateNodeType(node: Node, sourceCode: string): void {
	if (FORBIDDEN_NODE_TYPES[node.type]) {
		throw new UnsupportedNodeError(
			`${node.type}: ${FORBIDDEN_NODE_TYPES[node.type]}`,
			node.loc ?? undefined,
			sourceCode,
		);
	}

	if (!ALLOWED_NODE_TYPES.has(node.type)) {
		throw new UnsupportedNodeError(node.type, node.loc ?? undefined, sourceCode);
	}
}

/**
 * Check if an identifier is a dangerous global.
 * @throws SecurityError if the identifier is dangerous
 */
export function validateIdentifier(
	name: string,
	_allowedVariables: Set<string>,
	node: Node,
	sourceCode: string,
): void {
	if (DANGEROUS_GLOBALS.has(name)) {
		throw new SecurityError(name, node.loc ?? undefined, sourceCode);
	}
}

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Identify the node type named in the error and remove that construct from the SDK code.
  2. Replace the construct with an allowed equivalent (e.g., replace a tagged template with a plain string; replace comma operator with separate statements).
  3. If the construct seems essential to the SDK DSL, file an issue / extend ALLOWED_NODE_TYPES in validators.ts and add interpreter support — but do not bypass the check.

Example fix

// before (TaggedTemplateExpression)
const q = sql`SELECT * FROM t`;

// after
const q = 'SELECT * FROM t';
Defensive patterns

Strategy: validation

Validate before calling

import { parseSDKCode } from '@n8n/workflow-sdk/ast-interpreter/parser';
import { ALLOWED_NODE_TYPES } from '@n8n/workflow-sdk/ast-interpreter/validators';

function findUnknownNodeTypes(code: string): string[] {
  const unknown: string[] = [];
  const ast = parseSDKCode(code);
  JSON.stringify(ast, (k, v) => {
    if (v && typeof v === 'object' && 'type' in v) {
      const t = (v as { type: string }).type;
      if (!ALLOWED_NODE_TYPES.has(t)) unknown.push(t);
    }
    return v;
  });
  return [...new Set(unknown)];
}

Type guard

import { ALLOWED_NODE_TYPES } from '@n8n/workflow-sdk/ast-interpreter/validators';

function isAllowedNode(type: string): boolean {
  return ALLOWED_NODE_TYPES.has(type);
}

Try / catch

import { interpretSDKCode } from '@n8n/workflow-sdk/ast-interpreter/interpreter';
import { UnsupportedNodeError } from '@n8n/workflow-sdk/ast-interpreter/errors';

try {
  interpretSDKCode(code, sdkFunctions);
} catch (e) {
  if (e instanceof UnsupportedNodeError && !e.message.includes(':')) {
    // bare node type → not in allowlist and not in FORBIDDEN map
  }
  throw e;
}

Prevention

When it happens

Trigger: Any ES construct whose AST type is outside the allowlist: e.g., TaggedTemplateExpression, SequenceExpression (comma operator), AssignmentPattern (default parameters/destructuring defaults), ConditionalExpression chains with unusual nesting, EmptyStatement, LabeledStatement, BreakStatement, ContinueStatement, ReturnStatement (outside functions), ThisExpression, MetaProperty, ChainExpression.

Common situations: Using newer/less-common JS syntax the allowlist hasn't been updated for; tagged templates like sql`...`; comma-operator chains; labeled loops; `this` references; destructuring with defaults.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/004c3fd24def4031. Report an issue: GitHub.