Intermittent Execute Function failure: SyntaxError: Unexpected token '<', "<html>..." is not valid JSON

Hi,
I’m seeing an intermittent failure in an agent run where an Execute Function block fails with what appears to be a misleading syntax error:

In this example, the function block was meant to receive the previous router’s “false” response, but received HTML instead.

This only happens intermittently and can happen when a single or when multiple runs for the same agent are executing at the same time via API. For instance, 3 runs could be going but only one will fail. Other times one run could be going and it would fail too.

The location isn’t consistent either, it can happen before any one of the numerous function blocks in the agent run; regardless of whether they come after a router or another function. The same function blocks will complete normally for different runs, even if the same inputs are used.

It looks like the Python function runner, sandbox, or execution service might be receiving an internal HTML error response instead of the expected response.

Can someone confirm what could be causing this bug or whether there is a known fix? Or whether there’s a way to reduce or handle intermittent Execution Failures like this when the block code itself appears valid and the variables are already resolved?

The failed run ID used for this example is 41d021ed-416c-4e1a-874f-65ddb35d2a61 and I can share a Debugger link privately if there’s a secure way to send it.

Thanks!

Hi @Zhengfa12,

Thanks for the post!

I’d really appreciate it if you could DM me the debugger links for both a successful and a failed run. If you’re able to publish the agent and share the Remix link as well, that’ll let me copy it and investigate the function block.

Hi @Alex_MindStudio , thanks for the quick reply. I’m not able to DM you, perhaps it’s because my account is brand new. Is there any way I can email you the links?

Hi @Alex_MindStudio I’ve since gained access to messages and have DM’d the debugger links for both a successful and failed run and the Remix link.

Hi @Zhengfa12,

Thanks for sharing the links!

Your agent currently goes through an extensive loop for each glossary term and spins up multiple sandboxes each time, which is likely triggering an error. I’d recommend consolidating the per-term logic into a single Python function that returns a full JSON array of all terms. This would significantly reduce the number of sandboxes. From there, you can use a Run Workflow block to trigger a sub-workflow run for each item in the array, which also supports parallel execution and has a built-in retry logic:

Regarding the Claude Sonnet billing, it’s likely set as your workspace’s default text generation model and is used to generate run titles. You can update it here:
https://app.mindstudio.ai/services/default-models/llm_chat

Thanks for the recommendation @Alex_MindStudio , I’ll try and consolidate the functions even further. I’ve also confirmed that Claude Sonnet is not set as a default model anywhere. Disabling Anthropic but disabling Anthropic as an AI model provider here seems to have helped somewhat. https://app.mindstudio.ai/services/models