{"record":{"id":"db8cc8b774e6025c","repo":"n8n-io/n8n","slug":"unsupported-syntax-object-key-type-prop-key-ty","errorCode":null,"errorMessage":"Unsupported syntax: 'Object key type ${prop.key.type}' is not allowed in SDK code","messagePattern":"Unsupported syntax: 'Object key type (.+?)' 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":375,"sourceCode":"\n\t\tfor (const prop of node.properties) {\n\t\t\tif (prop.type === 'SpreadElement') {\n\t\t\t\t// Handle spread: { ...obj }\n\t\t\t\tconst spreadValue = this.evaluate(prop.argument);\n\t\t\t\tif (spreadValue && typeof spreadValue === 'object') {\n\t\t\t\t\tObject.assign(result, spreadValue);\n\t\t\t\t}\n\t\t\t} else if (prop.type === 'Property') {\n\t\t\t\t// Get key\n\t\t\t\tlet key: string;\n\t\t\t\tif (prop.key.type === 'Identifier') {\n\t\t\t\t\tkey = prop.key.name;\n\t\t\t\t} else if (prop.key.type === 'Literal' && typeof prop.key.value === 'string') {\n\t\t\t\t\tkey = prop.key.value;\n\t\t\t\t} else if (prop.key.type === 'Literal' && typeof prop.key.value === 'number') {\n\t\t\t\t\tkey = String(prop.key.value);\n\t\t\t\t} else {\n\t\t\t\t\tthrow new UnsupportedNodeError(\n\t\t\t\t\t\t`Object key type ${prop.key.type}`,\n\t\t\t\t\t\tprop.key.loc ?? undefined,\n\t\t\t\t\t\tthis.sourceCode,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Get value (handle shorthand: { name } === { name: name })\n\t\t\t\tconst value = this.evaluate(prop.value as ESTree.Expression);\n\t\t\t\tresult[key] = value;\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Visit an array expression.\n\t */","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/workflow-sdk/src/ast-interpreter/interpreter.ts#L357-L393","documentation":"In an object literal `{ key: value }`, keys must be an `Identifier` (`{ name: x }`), a string `Literal` (`{ \"name\": x }`), or a numeric `Literal` (`{ 0: x }`). Computed keys (`{ [expr]: value }`) and other key node types are rejected at interpreter.ts:375 because dynamic property names could construct dangerous keys at runtime.","triggerScenarios":"Writing `{ [computedKey]: value }` or `{ [Symbol.iterator]: fn }` in SDK code. At interpreter.ts:368-379, the key must be `Identifier`, string `Literal`, or number `Literal`; a computed property (`[expr]`) produces a different check path and lands in the `else` throw.","commonSituations":"Using computed/esoteric property keys; Symbol keys; porting code that builds objects with dynamic field names.","solutions":["Use static string or identifier keys: `{ myKey: value }` or `{ 'my-key': value }`","If the key name must be dynamic, build the object in a Code node and pass the result","Assign properties one at a time on a `const` object (property assignment IS allowed: `obj.field = value`)"],"exampleFix":"// before\nconst obj = { [dynamicKey]: value };\n\n// after\nconst obj = {};\nobj[dynamicKey] = value; // note: this is ALSO blocked if dynamicKey is non-literal\n// Best: use a static key\nconst obj = { fixedKey: value };","handlingStrategy":"validation","validationCode":"// Detect computed object keys in object literals\nfunction hasComputedObjectKey(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 === 'Property' &&\n      node.computed\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('Object key type')) {\n    // instruct user to use static identifier or literal keys\n  }\n  throw e;\n}","preventionTips":["Use static keys only: `{ name: value }` or `{ 'key': value }`","Never use computed keys `{ [expr]: value }` in SDK object literals","If dynamic keys are needed, build the object in a Code node"],"tags":["sdk-interpreter","object-literal","computed-key","security"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}