Sub-Workflow is not returning a value to the main workflow despite showing it in the execution and last node

Describe the problem/error/question

Sub-Workflow does not return an output to the main workflow despite not throwing errors and showing the output in the last node of the sub-workflow (still happening in v2.0.3

What is the error message (if any)?

no error

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

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

@n8n-by-qasim this is not true as there is no such node called “Return data”.

@tasky_eduardo It seems like you have a logical issue in your sub workflow. It will always return data if the siteId did not exist in your db, but in cases where it does, the “If row does not exist” will exexute last. This is because n8n will execute each connected node when split from a single node one after another, meaning in this case the top row of nodes fired, completed with data, but then the second row was fired in this sequence:

This is what is causing the blank response. See below workflow for fixing this issue:

Rather try and get the data using the Get operation from the data table and then using an IF node to check if it exists or not. This way the sub workflow will not try and fire all paths even if it shouldnt.

Remember to set the Get node to always output data so that it continues to the next step if no data was found in the data table.

This should fix your issue

2 Likes

Thanks for the solution, it seems to work now. Thanks for the lesson too, i’ll keep it in mind going forward!

1 Like

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