Pydantic code (tested to work in pyodide) fails in the code node

Describe the problem/error/question

pydantic code (tested to work in pyodide 0.23.2) fails in n8n 1.88 code node. More details can be found in the attached screenshots.

What is the error message (if any)?

{
  "errorMessage": "TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'\n",
  "errorDetails": {},
  "n8nDetails": {
    "nodeName": "prepParams",
    "nodeType": "n8n-nodes-base.code",
    "nodeVersion": 2,
    "n8nVersion": "1.88.0 (Self Hosted)",
    "binaryDataMode": "default",
    "stackTrace": [
      "Error: TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'",
      "",
      "    at PythonSandbox.getPrettyError (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code/PythonSandbox.js:91:14)",
      "    at PythonSandbox.runCodeInPython (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code/PythonSandbox.js:78:18)",
      "    at PythonSandbox.runCodeAllItems (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code/PythonSandbox.js:49:29)",
      "    at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code/Code.node.js:155:17)",
      "    at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:681:27)",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:915:51",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:1246:20"
    ]
  }
}

Please share your workflow

Information on your n8n setup

Well the error indicates you are trying to concat an empty object to a string. Which fails.

Why also, do you have a class in prepParams, and do nothing with it? It just returns a value and ignores everything else?

What is your goal with this? I personally don’t quite follow.