Internal Error running a block: TypeError: Failed to fetch

Screenshot 2025-01-24 at 11.51.46 AM

I'm building a workflow and I'm encountering this error in a number of different code blocks. Sometimes when I re-run it works right away, sometimes it keeps on erroring and then it works suddenly after the nth re-run.

I can't figure out what I'm doing that's affecting it because the code block just works, then in my next test it doesn't with this error. Sometimes it errors and then it works.

It has happened most often in a JS code and REST API code blocks. But can't give specific numbers on that, I've just been rerunning it until it works. Now getting annoyed about it though, so is there something that I can be doing better or different?

1 Like

Hello @audreyanne96,

Apologies for this issue. Let me check with our team and see what can be done to better troubleshoot this bug.

Unfortunately the error is not super descriptive so we will likely have to get more background info on what process is failing.

Are the JS code blocks executing fetch requests? This is very odd that it only happens intermittently and sometimes works fine, maybe the request is timing out on slow requests.

Are you self hosted or on the cloud?

Hi Jack -- Thank you for the response.

  • I get the error in various types of code blocks - usually Resource Query or a JS code block.
  • When it happens in a JS code block, the code is mostly just cleaning data fetched using a previous Resource Query.
  • It only happens while I am building a workflow or manually running the workflow code block by code block for testing. I don't think I've encountered the error in a full workflow run.
  • The workflow/s these happened to are now running fine. Was eventually able to get through building it and it is now deployed. It was just annoying while building, so would like to understand how I can avoid / prevent it for future builds.
  • We are on the cloud.

Hope the above helps. Thanks!

1 Like

Thank you so much for the well worded and detailed response!

My theory that the request is timing out some what makes sense for a Resource Query but does not at all for a JS code block, unless you are cleaning a really large amount of data :sweat_smile:

Good to hear that it only happens in the editor and not on the live app. This makes me think it might be a localized issue, maybe something to do with the networking or the local environment of the Retool IDE :face_with_monocle:

Since you are on cloud, if you get any more of these errors, please check the networking tab in your browsers inspector to get the x-request-id. We could use this to look up the request on the cloud servers and see if there are more details or clues to what is causing this error.

Wish I had a more straighforward answer on how to avoid this for future development but it seems the bug is not consistent :sweat: Once we look at the requests on our server we can tell if either the requests are not making it from your browser to the server or if the server has more information on what caused this "fail to fetch".

Hi @audreyanne96,

Glad to hear the issue isn't affecting the finished and deployed code.

My other theory would be that running a single block maybe be missing details from other blocks that are referenced in that running code block. Usually this would throw an error saying 'cannot' reference this specific variable :thinking:

Likely could be a timeout issue!

We did some digging and the best suggestion we could give to you or any other users that are getting this error while in development is that the query may need to handle a smaller amount of data.

Try batching, breaking the data up into smaller parts with loops, or sub-workflows to see if the data might be running into a bottleneck and exiting execution with this error :crossed_fingers: