{"record":{"id":"0242f8f4df12739d","repo":"n8n-io/n8n","slug":"unsupported-syntax-dynamic-property-access-is-n","errorCode":null,"errorMessage":"Unsupported syntax: 'Dynamic property access' is not allowed in SDK code","messagePattern":"Unsupported syntax: 'Dynamic property access' 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":342,"sourceCode":"\n\t\tconst obj = this.evaluate(node.object);\n\n\t\tif (obj === null || obj === undefined) {\n\t\t\tthrow new InterpreterError(\n\t\t\t\t`Cannot access property on ${obj}`,\n\t\t\t\tnode.loc ?? undefined,\n\t\t\t\tthis.sourceCode,\n\t\t\t);\n\t\t}\n\n\t\t// Get property name\n\t\tlet propName: string | number;\n\t\tif (node.property.type === 'Identifier' && !node.computed) {\n\t\t\tpropName = node.property.name;\n\t\t} else if (node.property.type === 'Literal') {\n\t\t\tpropName = node.property.value as string | number;\n\t\t} else {\n\t\t\tthrow new UnsupportedNodeError(\n\t\t\t\t'Dynamic property access',\n\t\t\t\tnode.property.loc ?? undefined,\n\t\t\t\tthis.sourceCode,\n\t\t\t);\n\t\t}\n\n\t\treturn (obj as Record<string | number, unknown>)[propName];\n\t}\n\n\t/**\n\t * Visit an object expression.\n\t */\n\tprivate visitObjectExpression(node: ESTree.ObjectExpression): Record<string, unknown> {\n\t\tconst result: Record<string, unknown> = {};\n\n\t\tfor (const prop of node.properties) {\n\t\t\tif (prop.type === 'SpreadElement') {\n\t\t\t\t// Handle spread: { ...obj }","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/workflow-sdk/src/ast-interpreter/interpreter.ts#L324-L360","documentation":"In a member expression for property access, the property must be either a static `Identifier` with `!node.computed` (`obj.name`) or a `Literal` (`obj[\"name\"]`, `arr[0]`). Any other property node type throws `UnsupportedNodeError` at interpreter.ts:342. This complements `validateMemberExpression` (which blocks computed access with non-literals via `SecurityError`) by catching any AST shape that reaches the property-name extraction without being an Identifier or Literal.","triggerScenarios":"Writing `obj[expression]` where the property is a non-literal — though most computed access is caught earlier by `validateMemberExpression` at line 314. This throw at line 342 catches edge cases where the property node type is something unexpected (e.g., a `TemplateLiteral` key).","commonSituations":"Dynamic property lookup with runtime-computed keys; template-literal keys (`obj[`${field}`]`); porting code that selects fields dynamically.","solutions":["Use a static property name: `obj.name` or `obj['name']` (string literal)","Use a numeric literal for array index: `arr[0]`","Move dynamic field selection to a Code node"],"exampleFix":"// before\nconst val = obj[key]; // key is a variable\n\n// after\nconst val = obj.fixedName; // or obj['fixedName']","handlingStrategy":"validation","validationCode":"// Detect computed property access with non-literal keys\nfunction hasDynamicPropertyAccess(code: string): boolean {\n  const ast = parse(code, { ecmaVersion: 'latest', sourceType: 'module' });\n  let found = false;\n  walk(ast, (node) => {\n    if (\n      node.type === 'MemberExpression' &&\n      node.computed &&\n      node.property.type !== 'Literal'\n    ) {\n      found = true;\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('Dynamic property access')) {\n    // instruct user to use static property names or literal keys\n  }\n  throw e;\n}","preventionTips":["Use dot notation: `obj.name` not `obj[variable]`","String literal keys are allowed: `obj['key']` and `arr[0]`","Move dynamic field selection to a Code node"],"tags":["sdk-interpreter","dynamic-access","computed-property","security"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}