How to handle malformed URLs

I’m working on a new agent that includes websites collected in three previous Generate Text blocks, that all execute successfully. However, when I present the URL’s the previous steps found, I get the following error:

"1
Action started on CloudRunner
Instance ID: gx8tg
at Jun 8, 2025 1:37:31.499 PM CDT
2
Scraping URL: “{{searchUrls}}”
3
Resolving variables
4
Scraping resolved URL: JSON
[
0: “Google Search
1: “https://www.linkedin.com/pub/dir/Bruce/Brinick
2: “https://www.facebook.com/search/people/?q=Bruce+Brinick
3: “https://news.google.com/search?q=Bruce+Brinick
4: “https://www.lexisnexis.com/search?query=Bruce+Brinick
5: “https://www.beenverified.com/s/people/Bruce+Brinick
6: “https://www.spokeo.com/search?q=Bruce+Brinick
7: “https://intelligence.intelius.com/search?q=Bruce+Brinick
8: “https://www.truelinked.com/search?q=Bruce+Brinick
]

Does anyone have a solution to this problem?

I’m not an experienced coder in JSON, Java or Python but my spidey sense suggests the solution should be a MindStudio Function.

Any help here will be appreciated.

Hi @Bruce,

Could you please record an overview of the Automations tab in your Agent, show an example of the issue in the Debugger tab, and share the Custom Function code and configuration? That’ll help us better understand what might be causing the error.

Also, feel free to check out the Custom Function section in our Troubleshooting Guide:
https://community.mindstudio.ai/t/troubleshooting-guide-101/71#p-104-custom-function-error-5

Here’s a link you can use to record:

Alex,

Will do.

Thanks.

Alex,

I just submitted a recording that includes (I hope) all that you’ve asked for.

Thanks in advance for your help.

Blessings.

Hi @Bruce,

Thank you for the recording!

It looks like your Custom Function is working as expected since it’s only checking whether the URL formatting is correct.

The issue seems to come up when you’re passing an array of URLs into the Scrape URL block. In this case, the Run Workflow block would be a better fit for your use case.

Here are a couple of examples you can remix into your workspace to explore how they’re structured:

Simple : https://app.mindstudio.ai/agents/run-workflow-simple--remix-46a2a888/remix

Advanced : https://app.mindstudio.ai/agents/run-workflow-advanced--remix-f3bfba48/remix

The key difference between them:

  • The Simple version uses an Iterator to process individual items
  • The Advanced version works with a structured JSON array

Since you’re already working with a JSON array, the Advanced version is probably the best option for your setup.

Hope this helps!