Infinite Loop Error

Hi,

I have made a few changes to the agent to ensure that all JSON objects were resilient and consistent throughout the agent, hoping that might help. I have ensured that all Run Workflow blocks are set to zero retries and ignore failures; and except for the deepest one, they’re all set to sequential execution mode. The “Maximum Operations per Invocation is set at the top value of 2000. This latest agent is newly-published (and newly-named) to make sure that all these settings are applied correctly.

I am still seeing the infinite loop error in multiple places and am still seeing sub-workflows restart from the first array element.

Agent ID is: f6eb9ed9-df5a-4c06-a609-267ea13458f7

Agent workflow structure is:

Main

BusinessDetails (no problems here)
EnrichBusiness (all the problems happen from here, down)

DeepGoogleSearch

SmartScrape

Here are the logs everywhere the infinite loop is flagged – note that it isn’t always in the same workflow. I copied these from the bottom, up, of the run list in the left panel (most recent at end, below). Very odd that the timestamps are all over the place, even though all the workflows are in sequential execution mode.

## Working with Element [0] in the EnrichBusiness flow.

1 Action started on CloudRunnerInstance ID: cq6pm at Sep 18, 2025 9:19:54.468 AM PDT

2 Starting workflow: DeepGoogleSearch

3 Infinite loop prevention: The same run workflow block can not be invoked more than once in a single run

Run Failed: Execution error

https://app.mindstudio.ai/share/debugger/f6eb9ed9-df5a-4c06-a609-267ea13458f7/0bd1249d-ca02-4e8f-9bda-165cd735ab86

## Working with Element [1] in the EnrichBusiness flow.

1 Action started on CloudRunnerInstance ID: pw2st at Sep 18, 2025 9:16:01.849 AM PDT

2 Starting workflow: DeepGoogleSearch

3 Infinite loop prevention: The same run workflow block can not be invoked more than once in a single run

Run Failed: Execution error

https://app.mindstudio.ai/share/debugger/f6eb9ed9-df5a-4c06-a609-267ea13458f7/cb841f32-0fb9-476b-8c11-81c9c1df8aa4

1 Action started on CloudRunnerInstance ID: pw2st at Sep 18, 2025 9:16:02.434 AM PDT

2 Starting workflow: SmartScrape

3 Infinite loop prevention: The same run workflow block can not be invoked more than once in a single run

Run Failed: Execution error

https://app.mindstudio.ai/share/debugger/f6eb9ed9-df5a-4c06-a609-267ea13458f7/2bf6fec4-ba8a-4241-870a-04dbe3f4b15d

1 Action started on CloudRunnerInstance ID: pw2st at Sep 18, 2025 9:17:08.466 AM PDT

2 Starting workflow: SmartScrape

3 Infinite loop prevention: The same run workflow block can not be invoked more than once in a single run

Run Failed: Execution error

https://app.mindstudio.ai/share/debugger/f6eb9ed9-df5a-4c06-a609-267ea13458f7/3accabb5-8c81-4101-9901-e259d4ac2c5a

## Working with Element [2] in the EnrichBusiness flow.

1 Action started on CloudRunnerInstance ID: cq6pm at Sep 18, 2025 9:20:00.754 AM PDT

2 Starting workflow: DeepGoogleSearch

3 Infinite loop prevention: The same run workflow block can not be invoked more than once in a single run

Run Failed: Execution error

https://app.mindstudio.ai/share/debugger/f6eb9ed9-df5a-4c06-a609-267ea13458f7/98e517ab-1b11-4a6f-99ad-acfb4e287a13

1 Action started on CloudRunnerInstance ID: cq6pm at Sep 18, 2025 9:19:48.736 AM PDT

2 Starting workflow: SmartScrape

3 Infinite loop prevention: The same run workflow block can not be invoked more than once in a single run

Run Failed: Execution error

https://app.mindstudio.ai/share/debugger/f6eb9ed9-df5a-4c06-a609-267ea13458f7/bb744069-b7e8-44cd-ac27-18aad3d883fe

1 Action started on CloudRunnerInstance ID: cq6pm at Sep 18, 2025 9:19:48.297 AM PDT

2 Starting workflow: SmartScrape

3 Infinite loop prevention: The same run workflow block can not be invoked more than once in a single run

Run Failed: Execution error

https://app.mindstudio.ai/share/debugger/f6eb9ed9-df5a-4c06-a609-267ea13458f7/77d98871-f8e5-4495-baaa-75420033cb32

The EnrichBusiness flow was invoked with an array of seven elements. They executed in this order, according to the run log (even though every flow is set to zero retries):

0 → 1 → 2 → 3 → 0 → 0:

[Element 0]: Action started on CloudRunnerInstance ID: vmwhb at Sep 18, 2025 8:41:20.679 AM PDT

[Element 1]: Action started on CloudRunnerInstance ID: vmwhb at Sep 18, 2025 8:48:44.673 AM PDT

[Element 2]: Action started on CloudRunnerInstance ID: vmwhb at Sep 18, 2025 8:57:57.012 AM PDT

[Element 3]: Action started on CloudRunnerInstance ID: vmwhb at Sep 18, 2025 9:04:16.772 AM PDT

[Element 0]: Action started on CloudRunnerInstance ID: 2twf4 at Sep 18, 2025 9:11:48.394 AM PDT

[Element 0]: Action started on CloudRunnerInstance ID: pw2st at Sep 18, 2025 9:16:06.618 AM PDT

A separate (but maybe related) issue: There is a call to a JavaScript function that works 99.5% of the time. This is a simple function that counts characters in a text string. But sometimes it throws a weird error:

1 Action started on CloudRunnerInstance ID: vmwhb at Sep 18, 2025 8:55:30.130 AM PDT

2 Resolving variables

3 Resolved function configuration object: JSON

4 Loading code

5 Provisioning Sandbox execution enviroment

6 Preparing JavaScript runtime (Node v22.15.0 LTS)

7 Executing “ScrapeSize JS”

8 Error: SyntaxError: Unexpected token ‘<’, “ <h”… is not valid JSON

Run Failed: Execution error

https://app.mindstudio.ai/share/debugger/f6eb9ed9-df5a-4c06-a609-267ea13458f7/9c4ff18e-b9b4-4ad0-929b-081751c4d506

Cc: @Alex_MindStudio , @jerry-mindstudio

I’m having the same issues:

ID: bb124512-61b2-43bc-9ede-ee614420d37a

However, when i turned my 1st workflow to sequential, it worked.

@Alex_MindStudio I really need speed. Can we increase the 2,000 number to more?

Hi Ken,

Thanks for sharing the details. I was able to replicate the issue on my end.

This is a fairly heavyweight Agent as it’s currently set up, since it’s invoking multiple sub-workflows inside other sub-workflows. To avoid the Infinite Loop error and make the Agent more reliable, I’d suggest keeping Run Workflow blocks only in the Main.flow, rather than creating forks within forks. For example:

  • The first Run Workflow block generates the queries
  • The second performs the Google Search
  • The third performs the DeepGoogleSearch

If you run into timeout issues, splitting the Agent into a smaller suite of Agents can help. For instance, one Agent could focus only on generating queries and saving them in Google Sheets, Airtable, or Supabase, while another Agent picks up those queries to handle the research.

That’s very frustrating. Because I only use mindstudio exactly to be able to develop deep and complex agents…

I’m still getting timeouts.

I don’t know what to do as I have to deliver a project next week and these limitations of mindstudio are blocking us.

Can you take out the limits on my account so it can work?

@Alex_MindStudio Maybe if I use JUMP instead of RUN is better? because in this case the source workflow will not keep running in the back and will not be waiting for the end of the run. Makes sense?

But in this case I can’t run each element of the array separatedly…

Hi @fernando.damasio,

Just to clarify: the Run Workflow block is meant for launching multiple runs of a sub-workflow, while the Jump block simply takes a user into that workflow, continuing the same run.

If a sub-workflow takes too long to execute or retries multiple times, the initial workflow can time out since it never gets a response back in time.

The most reliable approach is to split the Agent into smaller Agents so each one can handle its tasks without running into these issues.

@Alex_MindStudio Ok, will do! However, I just need a final clarification, as I’m considering the possibility of encountering the same issue with different agents.
If I call other agents using RUN workflow, the source agent will be waiting the same way right? So, if the next agent takes too long (and it will), source will timeout too.
Maybe I could use the JUMP. But now I see that you can’t call other agents from it, only workflows.
Final concern is Maximum Operations per Invocation: from the description of this filed, I don’t know if this limit is per agent, per RUN workflow block, or per user action…

Hi @fernando.damasio,

Yes, you’ve got it right.

Regarding Maximum Operations per Invocation, the setting applies to the whole Agent. Most of the time, it mainly impacts the Run Workflow block, since that block usually launches multiple runs of a sub-workflow within your Agent.

Will try and get back to you!

Hi @Alex_MindStudio . Thanks for the update! Good to know that you could reproduce this.

Nested workflows were taught in the bootcamp, and fit the use case here perfectly. Nevertheless, I did already partially do this. Your suggestions are a workaround, not a fix for the core problem.

The below was composed earlier this morning before you sent your latest response - please read carefully (especially the first example)…

So, to see if it would have any influence on the infinite loop issue, I decided to refactor the agent a bit to eliminate the lowest-level workflow and replace it with a single aggregated LLM call in a Generate Text block. It did help, but other problems persisted or were newly uncovered. Below are logs from two separate versions of the agent. I continued testing on multiple runs – the details are repetitive, but the results are interesting: Subsequent runs, without changing anything, fail in different ways at different places.

Bottom line conclusion: All the evidence so far, and especially the first item below, point to a memory leak in your system.

The new agent workflow structure is:

Main

> BusinessDetails (no problems)

> EnrichBusinesses

>> GoogleResults

Again, there are no logic loops or recursion loops at all. Workflows are all set to zero retries; EnrichBusinesses is sequential mode, and GoogleResults is parallel mode. Max operations per invocation is set to 2000.

## First run:

Agent ID: 13666a3f-d642-4a66-abc6-94468d9ce4ee

EnrichBusinesses executed the 7-element input array in this element order:

0 → 1 → 2 → 3 → 0 → 4 → 1 → 5 → 6 → 2 → 3 → 4 → 5 → 6

But the most interesting observation is with the first run of element [3] – individual blocks within the workflow ran twice!! These blocks are linearly linked with no loops in the architecture. The last four blocks in EnrichBusinesses are:

Run Workflow (GoogleResults) Generate Text (Compile & Summarize) Display Content (Append Summary) End

The last three blocks (after the Run Workflow) each ran twice.

Here’s the log: https://app.mindstudio.ai/share/debugger/13666a3f-d642-4a66-abc6-94468d9ce4ee/53cf0b6a-ddee-4713-a802-6fd199f534f0

## Second Run:

Agent ID: 482dd4ce-fa3a-485e-a55b-5ff1124479fa

I made a minor change to the Generate Text (Compile & Summarize) block, lowering the temperature to 0.2. No internal block repetition this time (coincidence?). But EnrichBusinesses still did a restart on the input array (but only once):

0 → 0 → 1 → 2 → 3 → 4 → 5 → 6

Interestingly, the second instance of element [0] started before the first instance of element [0] ended:

Same problem happening here. RUN Workflow is running more elements. Looks like inputs are liking. @Alex_MindStudio