IF Node runs nodes in false path but the flow goes for true path

Describe the issue/error/question

How is possible that the true path of if continues with activation?
The “if” node says that the false path was activated:

What is the error message (if any)?

ERROR: Cannot read properties of undefined (reading ‘split’)

TypeError: Cannot read properties of undefined (reading 'split')
    at Object.execute (/private/var/folders/5b/0z88mwfd2339srrjkk1j8p7r0000gn/T/AppTranslocation/D8A60E1C-D32B-415B-9147-8666812112B1/d/n8n.app/Contents/Resources/app/node_modules/n8n-nodes-base/dist/nodes/Microsoft/OneDrive/MicrosoftOneDrive.node.js:172:71)
    at Workflow.runNode (/private/var/folders/5b/0z88mwfd2339srrjkk1j8p7r0000gn/T/AppTranslocation/D8A60E1C-D32B-415B-9147-8666812112B1/d/n8n.app/Contents/Resources/app/node_modules/n8n-workflow/dist/src/Workflow.js:594:51)
    at /private/var/folders/5b/0z88mwfd2339srrjkk1j8p7r0000gn/T/AppTranslocation/D8A60E1C-D32B-415B-9147-8666812112B1/d/n8n.app/Contents/Resources/app/node_modules/n8n-core/dist/src/WorkflowExecute.js:537:64

Please share the workflow

Sorry the workflow is bigger but the limit of characters avoid me to upload. I hope that only with this part will be useful:

Information on your n8n setup

  • n8n version: 0.182.0
  • Database you’re using (default: SQLite): N/A
  • Running n8n with the execution process [own(default), main]: own
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: desktop app

So, Cannot read properties of undefined (reading ‘split’) mean that you’re trying to run split method on undefined (something what not exist). But I cannot find anywhere split method. You may need somewhere add checking about that
Instead of using obj.split() use obj ? obj.split() : false that will check if object exist and only if it’s will run split method on them, otherwise return false.
You have many if nodes, can you specify which of them working wrong?

1 Like

Hey there, it seems like your split error is coming from the Microsoft One Drive node. The only split method I can find in the code is when creating folders and when trying to get the folder name parameter.

You do use two OneDrive create folder nodes with an expression for the folder name. Can you make sure that your expressions are working correctly. If your expression would result in empty strings this would break.

1 Like

Thank you very much for you quick support @Shirobachi and @marcus. I think that you are right @marcus:

The Node “Crear carpeta expediente” has the next 2 expressions:

  • Name: {{$node[“bucle actualizar expedientes1”].json[“expediente”]}}
  • Parent Folder ID: {{$node[“ID_ROOT_FOLDER”].json[“ID_ROOT_FOLDER”]}}


“Parent Folder ID” comes from one node in the beginning of workflow and it is not possible be empty.
But “Name” comes from the output data of the SPLIT IN BACHES NODE (“bucle actualizar expedientes1”)

I suppose that as the first IF NODE (“hay expedientes no creados3”) of the previous picture returns false value, then the output data from SPLIT IN BACHES NODE (“bucle actualizar expedientes1”) is empty and the ONEDRIVE NODE (“Crear carpeta expediente”) fails.

But the question is why is running this nodes? the IF NODE runs the false path not the true path. This is my real doubt.

Thank you again for your time and support!

It’s a little tricky to understand your workflow :smile: but let’s see if we can find some things out.

So merge nodes can try to execute previous path on both their inputs to get the data they need, so that might be happening in your case.This is just a guess since I cannot try out your workflow.

At then end of your workflow you are waiting for both path to end using a merge node. Do you really need that merge node? Can you remove it and try again?

Hello @marcus,

Yes, you are right, my workflow is a little tricky to understand. It is because I cannot upload whole workflow due the maximum limit of characters in the topics. Anyway, I use the final merge node because I want to have an only one final node for the workflow instead to have more than one. This workflow is calling from other.
At the end I have resolved using a little trick:

Doing the previous trick, it is the same if the flow goes by true path because it will stop there if there aren’t expedients. But still I have the doubt why the flow runs true path nodes when the executions shows that went by false path.

Anyway, thank you for your time, patient and help.

Hey francho,
I am glad to hear that you were able to find a solution.

The only explanation I know would be the merge node after your IF node is trying to execute both input flows. Anyway, this is just a guess. Happy automating.

1 Like