Loop Start and End nodes not in same workflow error (with nested loops)

I am looking for some help on understanding an error that I am confused on why this error is coming about. The workflow is quite complex, but the part that I am most perplexed is that the workflow that I am having issues is a modification of an existing workflow that does not have this error.

The modification to the existing workflow is to utilize Microsoft Sharepoint file system for reading input files and storing manipulated output files (vs prior version used a shared network drive location).

This particular workflow has two nested loops, the outer loop has most of the work, the inner loop is near the beginning of the workflow and looks at a specific sharepoint location for presence of a file, the workflow goes into a “Wait” node if no file, and will check every xxx seconds for a file to show up. If the file is present, the outer loop has a long sequence of manipulations, file reads, etc, then writes the manipulated data to a file and moves the original inputs to an archive, then will go back to the beginning of the outer loop (and generically will end up in the inner loop “waiting” for the next new file to show up and be processed - the prior file just worked on has been moved in the last parts of the outer loop).

My current suspicion to cause the error may be related to “Generic Loop Start” has a file system port as shown in the snapshot (blue box), while the “Variable Condition Loop End” in green box that I am using to loop back to the start has a table port (I am speculating because this is really the main change as far as loop start / end from the prior workflow that did not see this issue).

I use variables to set the expected file locations, and when making the conversion to the MS Sharepoint location, using the file system port seemed to resolve a number of issues I was having getting the files to read and write correctly, however I am now having this new error. I was also seeing a “Loop Wired Incorrectly - cannot branch outside of loop” error on the inner loop that looks for the file / waits if no file then looks again. Based on some reading in the forum, I made that relatively simple inner loop content into a metanode, and that issue went away.

Any inputs on what I am doing incorrectly? In this case, I am using this loop end to allow a relatively large number of iterations of this file manipulation to occur, then I want to stop the workflow and do some eval of the data (so this method of ending the loop is a bit arbitrary - and could be handled a different way). As stated, the prior workflow that used a mapped network drive for the file locations is essentially identical but has not had this issue.

Hello,
I think I’ve seen this elsewhere on the forum and the solution seemed to use the same type of start and end loop (both need the blue box). Is there a way you could test out if your workflow has this issue as well.

I will apologize in advance - this response will be a bit long, but hopefully someone can help with some recommendations / debug inputs.

I generated a simplified workflow that has similar loop structure, but far fewer manipulation steps vs. the full workflow that I am seeing the error “Loop start and end nodes are not in the same workflow”. The simplified workflow runs with no issues and runs as I would expect. It did not need the file system port to work (and you cannot add that type of port on the end loop node).

I will paste in a series of snapshots of the flow variables progression comparing the simplified flow (blue text on snapshot) and the full flow (red text), noting the start / end node IDs and what looks different (it seems that the simplified flow that works drops off the variables related to the inner loop when it completes, but the full workflow keeps those variables up to the point of the error - every other node executes as I would expect). And note that I have the “inner loop” on the full flow contained in a metanode.

Simplified workflow - iterating without the file to process present (looks, waits, looks, waits…):

Full workflow - same state:

Simplified workflow - exiting the inner loop, a file is present to use for outer loop processing.

Full workflow - exiting the inner loop.

Simplified workflow - has completed several iterations of the outer processing loop with no issue.

Full workflow - at last node prior to generating error (this has not completed the outer processing loop). I see “currentiteration” owned by node 191 (I would expect it to be 190, i.e. the outer loop start This is likely the issue, do not know what to try next).

And the error:

I noted in the original post, I had made a change to the full workflow to put the “wait for file” loop in a metanode that eliminated a different error ("Loop Wired Incorrectly - cannot branch outside of loop” error) but it seems like I now have a different issue (or a different version of same problem).

And is there a way to share the workflow? Perhaps using a SQLite connector instead? I’m not sure how this error can occur without using nodes that call other workflows, but looking at the wf would be best.

I think sharing the workflow would be problematic and is not possible, is all corporate data, the workflow is also quite large, the files that are accessed are in an corporate secure access controlled file system and data is proprietary, very large files / count of columns that are manipulated, etc.

I could likely paste in the output window from the “Select Scope” option when from the “Variable Condition End Loop” node that I am seeing the issue. I know is not the same as sharing workflow, but may give some information that could help point out the problem- any thoughts?

Possibly compare / contrast the “Select Scope” info for thoughts on what could be causing issue between workflow that operates as expected when I am using networked drive vs. the sharepoint version that does not work as expected (that is same structure as far as I can understand).