Problems obtaining the response from the sub-workflow

Describe the problem/error/question

I have a very simple scenario, but I can’t get it to work. The scenario is that the main workflow calls a sub-workflow, and when the sub-workflow finishes, it returns whether it worked correctly or not.

I have run tests and the error occurs when the subworkflow has a loop. If I omit the loop, the automation works correctly, but when I add the loop, it fails.

I cannot copy the nodes because they contain a lot of personal information that I cannot share.

Main workflow

Sub-Workflow

What is the error message (if any)?

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

Information on your n8n setup

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

Hey, how does it fail? Any errors that you see? Or maybe it doesn’t output data? FYI: there is a bug that prevents sub-workflows from returning data back to the main flow, if they contain any kind of node that waits for something

2 Likes

The response I want to get from the sub-workflow is a very basic JSON.

{
   "status": "OK"
}

status = OK/FAIL

As I explained at the beginning, if I exclude the loop, it returns the data correctly.

Note that with or without the loop, the workflow works perfectly; the only thing is that it does not return the information to the main workflow.

Oh, that must be the error. My workflow runs an Ansible playbook and waits for a response from a webhook when it has finished.

Has a workaround been found?

this part might be the issue

because it’s a bit weird when you are looping some items, but when it goes to false, the loop just stop n you just go “No Operations, do nothing” i am not sure what you are trying to achieve with this logic, but i think whatever the result of a loop over, the inside of a loop needs to always comes back to the loop itself, and only gets out of it through the done branch of the loop over items

hope this helps in anyway

2 Likes

The workaround would be to have the subflow write the output somewhere externally, Sheets, DB, wherever. Then the main flow will have to read it, once it continues (it should use Wait on Sub-flow to complete).

It’s a nasty bug, that we will have to learn to live with until n8n 2.0…

Feel free to mark my previous reply as Solution :slight_smile:

In the case you mentioned, an n8n contributor states:

Thanks for the report, this reproducible and the issue is being investigated. This also affects Wait nodes in After Time Interval mode if the wait timer is longer than 65 seconds.

This is not my case, as I do not wait for X amount of time, but rather wait for a webhook to return.

I modified my subworkflow to see if removing the if statement inside the loop would fix the error, but it didn’t :frowning:

It still doesn’t return the information requested.

just making sure that you have enabled this upon calling the sub right?

2 Likes

I have tested it and confirmed it is affected by any wait node, especially when waiting for a webhook, form, response, etc. Sorry, but your flow would also be affected :confused:

You can test with a very simple 2 flow setup with whatever wait node you want to validate it for as well.

Yes, I have it marked.

Okay, thank you very much for your time and for this tool’s great community.
I will close this case and follow the official case while awaiting a solution. :slight_smile:

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