Error: Code doesn't return items properly, I do not see why my output is not array of objects :(

Describe the problem/error/question

Hello, I am trying to do a data transformation and I am aware n8n node needs to return an array of objects witch from my browser console it seems I am doing but still getting “Code doesn’t return items properly”. Anybody can see what is wrong with my output?

What is the error message (if any)?

Code doesn’t return items properly

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

I am trying to transform data to aggreagate them by the same “client_id”
Data structure:

return [
{
"task_id": 
"86944prfy",
"task_name": 
"Your scenario [NB] Profichemia - Podepisovani Vydejek has been stopped due to an error.",
"time_spent": 
300000,
"client_name": 
"Company A",
"client_id": 
"90040965127"
},
{
"task_id": 
"86943yjy1",
"task_name": 
"Your scenario XYZ",
"time_spent": 
300000,
"client_name": 
"Company A",
"client_id": 
"90040965127"
},
{
"task_id": 
"86940td6a",
"task_name": 
"Your scenario [NEW][NB] Organization Created - ICO validace / duplicity / ARES has encountered an error.",
"time_spent": 
300000,
"client_name": 
"Company B",
"client_id": 
"90040769068"
}

Information on your n8n setup

  • n8n version: 1.33.1
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: MacOS 14.4

hello @Lukas_Vondra

You have forgotten to return the items in the last node. Add this part to the end:

return aggregatedTasksByClientId
2 Likes

Thanks a lot.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.