Need for information for "Attempt to load a function from a different Lua VM" error while using Parallel Luau

information provided here isn’t useful as there’s no stack trace information, how am I supposed to find where the error is coming from?

Expected behavior

I should be able to tell where the error is coming from

1 Like

Try disabling scripts one by one until you find out which one is causing the error. This behavior is probably intended though because your code probably caused Roblox’s internal code to error, but they could at least print out the last line of your code that was executed.

I’ve never seen that error before, I’d like to see the code that causes it if you find it

1 Like

I know it is related to using Parallel Luau, I’m not going to waste my time by trying to find it, I just disabled Parallel Luau code

It’s really unfortunate that something like this happens, and the already under utilized Parallel Luau feature can’t even be used because of this lack of debug-ability

1 Like

You should include that in the title.

This is just an acknowledgment announcement!

We’ve filed a ticket into our internal database for this issue and will start investigating, we will update you when we have further information.

Thanks for flagging!

Hi there! While I was working on investigating the issue, I believe it may have been fixed by a (seemingly) unrelated change. Can you confirm if the “different Lua VM” error you’re getting still lacks line info? Currently, this is what I see:

error log harvested just now, still no location of where the error happened

soo I can send you a place file i’m using

more context: this error happens after I changed my Folder into an Actor for my Core Localscript that requires everything else in the game

Code
local CollectionService = game:GetService("CollectionService")
local RunService = game:GetService("RunService")
local TestService = game:GetService("TestService")

local function runScripts(require)
	for _, instance: Instance in ipairs(CollectionService:GetTagged("Auto-Run")) do
		if instance:IsA("ModuleScript") then
			local modulescript = instance :: ModuleScript
			task.spawn(require, modulescript)
		else
			warn(instance:GetFullName(), "is NOT a ModuleScript")
		end
	end

	CollectionService:GetInstanceAddedSignal("Auto-Run"):Connect(function(instance: Instance): ()
		if instance:IsA("ModuleScript") then
			local modulescript: ModuleScript = instance
			task.spawn(require, modulescript)
		else
			warn(instance:GetFullName(), "is NOT a ModuleScript")
		end
	end)

	for _, instance: Instance in ipairs(CollectionService:GetTagged("Auto-Run [Client]")) do
		if instance:IsA("ModuleScript") then
			local modulescript = instance :: ModuleScript
			task.spawn(require, modulescript)
		else
			warn(instance:GetFullName(), "is NOT a ModuleScript")
		end
	end

	CollectionService:GetInstanceAddedSignal("Auto-Run [Client]"):Connect(function(instance: Instance): ()
		if instance:IsA("ModuleScript") then
			local modulescript = instance :: ModuleScript
			task.spawn(require, modulescript)
		else
			warn(instance:GetFullName(), "is NOT a ModuleScript")
		end
	end)
end

local ENABLE_BENCHMARKER: BoolValue? = TestService:FindFirstChild("ENABLE_BENCHMARKER")
if RunService:IsStudio() and ENABLE_BENCHMARKER and ENABLE_BENCHMARKER.Value then
	local timeMap: { [number]: ModuleScript } = {}
	local timeList: { number } = {}
	local totalTime: number = 0

	runScripts(function(modulescript: ModuleScript): ()
		local startTime: number = os.clock()
		require(modulescript)
		local endTime: number = os.clock()
		local runTime: number = endTime - startTime
		totalTime += runTime

		timeMap[runTime] = modulescript
		table.insert(timeList, runTime)
	end)

	local function results(): ()
		table.sort(timeList)
		for _, runTime: number in ipairs(timeList) do
			warn(timeMap[runTime], runTime)
		end
		warn("Total Runtime:", totalTime)
	end
	results()
else
	runScripts(function(modulescript: ModuleScript)
		-- task.synchronize()
		require(modulescript)
		-- task.desynchronize()
	end)
end

It’d be great if you could send me your place file, yeah!

I get this same nondescript error with no indication of which script or line might be at fault. Has there been any progress to address this issue?

I haven’t reproduced the error yet, so no - not to say it’s impossible to do, it just seems to take some specific circumstances. If you could send me your place file as well, I could start investigating with the debugger right away!

I believe this may actually have to do with scripts under an Actor that reference or use Bindable Functions or Remotes. My scripts were a bit involved where I couldn’t separate them out to test. But a friend directed me to this post that referenced a similar error which only occurred for me when scripts were moved under an Actor: An overcomplicated look into Bindable immutability

It would just be extremely helpful if these errors would list the line of the entry and script in question with some context of the culprit method being the call so it isn’t left to a guess.

1 Like

So, this specific case turned out to be an edge case in our code. You can recreate it by making LocalScript under an Actor, inside of StarterPlayerScripts, that requires a ModuleScript which calls BindToRenderStep with an anonymous or local function. In OP’s case, it was the fact that they made a LocalScript to require a module that in turn required the PlayerModule, which then called BindToRenderStep. I’ve created a fix for this specific case that will be coming Soon™, so @RuizuKun_Dev you shouldn’t get the error at all anymore once it drops!

The “Attempt to load a function from a different Lua VM” error not having line info in some cases is a separate issue which (due to some code limitations) can’t be solved at the moment, since it would require a larger refactor.

2 Likes

The fix has been deployed and should be rolled out by now. Please check that everything is working on your end and let me know if you have any further questions!