No error information given when a required ModuleScript fails to load after yielding

Recently I have discovered that when a module throws an error while loading after having yielded (e.g. wait, InvokeServer, or other API calls), the source error does not get displayed and only the generic ‘Requested module experience an error while loading’ error shows:
image
This happens both in studio and in-game, and is quite annoying as it means I need to manually catch errors with pcall and log them myself. I think it began happening sometime in the past two weeks?

9 Likes

This has been happening to me. I am using FastSpawn to run a whole bunch of modules and this is making it impossible to know where and in which module the error is taking place… It doesn’t happen every time though, usually I do get normal errors.

1 Like

Looking at it, is your Module called HUD? If so, the error is on Line 4.

The error shown in output isn’t descriptive, but it tells you what line caused the error.

Line 4 is where require is being called, not where the actual original error is coming from.

4 Likes

Weird. When my modules error it tells me what’s wrong with them.

Let me go and force a module to error and test it again to see if this happens with me too.

Make it a pcall function and print the error?

Can’t seem to reproduce this problem. This error shows up for me.

image

1 Like

By the looks of it happens inconsistently, could be related to the session somehow. I’m not quite sure what’s up with it, when it does happen for an object it happens consistently with that object. Perhaps team create?

1 Like

That’s what I was just wondering, I’m in a team create and it showed the error just fine. Does it still do it if you restart your studio?

And is it all modules or just that one module?

I called error() on every module under HUD and it printed the correct error twice, and didn’t print it all of the other times:
image

And it still continues to happen after closing and reopening studio?
It’s weird that it seems to be just that one module though and the others showed the error.

I completely restarted studio and it still happens with exactly the same output as above. Could be related to the team create server maybe, if it isn’t specifically the module object on its own?

I tested a module in my studio with team create going (since I had a game open in studio already.)

If you save the place as a local backup and run it and cause it to error still, does it show the error or does it not display it. If it doesn’t display it, it seems to be something with the module or Roblox’s logger so it can’t get the error from the crash to display it.

Well the issue is still happening in a local copy so it’s not team create. I’ll try and make a repro file since it looks like that is possible.

1 Like

I hope they can get it fixed.

If you remove the code from your module and just error(“message”), does it display the error?

I was just doing that now, I removed everything and it appears to be erroring fine without issues now. I then did some narrowing down and it appeared MarketplaceService:UserOwnsGamepassAsync, wait(2) and RemoteFunction:InvokeServer were causing/correlated with the issue (commented out = no issue, one of them running = issue). So presumably any yield? I also ran those things in spawn() and no issues.

I wonder if it’s just holding the thread too long and causing it to break something?

What happens if you put a wait(1) error() in another module, does it show the error?

Edit: just tested this

wait(1)
error()

Causes the module to error and return no error message.

That seems to be it. Same result with a different ModuleScript. Also confirmed that throwing an error before yielding has no issues.

1 Like

So, something is broken in Roblox where when a module yields in a thread for any reason then errors it won’t show the error message.

We have a fix for this which will ship in 10 days or so.

8 Likes