Fix: Prevent uncatchable capability error from DefineFastFlag in client scripts#11
Open
4bdullah0 wants to merge 1 commit intoRoblox:mainfrom
Open
Fix: Prevent uncatchable capability error from DefineFastFlag in client scripts#114bdullah0 wants to merge 1 commit intoRoblox:mainfrom
4bdullah0 wants to merge 1 commit intoRoblox:mainfrom
Conversation
…nt scripts DefineFastFlag requires RobloxScript capability, which client scripts (LocalScripts) do not have. When called from client context, this throws an uncatchable capability error that bypasses pcall/xpcall, causing applications to crash with 'Error occurred, no output from Luau'. Root cause analysis: - Initial debugging attempted React setup fixes (Folder -> ScreenGui, StrictMode restructuring) but the crash persisted - Investigation revealed the issue was in library code attempting DefineFastFlag in a client context - Capability errors cannot be caught by pcall/xpcall in Roblox Solution: - Check script context using RunService before attempting DefineFastFlag - Only call DefineFastFlag in server contexts where capability exists - Client scripts use the safe default (true) without attempting the call - Preserves FastFlag functionality on server while preventing client crashes Benefits: - Eliminates uncatchable capability errors in all client contexts - Maintains FastFlag functionality for server-side A/B testing - Uses safe default (enables memory leak fix) in all contexts - Backward compatible with existing server behavior This fixes crashes affecting all client-side React-Roblox applications using roblox-ts or Luau React directly. Testing: - Verified with roblox-ts React application in client context - Confirmed proper rendering with createRoot and ScreenGui - No errors in client or server contexts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When I tried using React-Roblox in a LocalScript, my app immediately crashed with this error:
The crash happens in
RobloxComponentProps.luawhen it tries to set upFFlagReactFixBindingMemoryLeak.How I Found the Issue
At first, I thought it was my code. I tried:
Folderto aScreenGuifor the root containerStrictModewrapperNothing worked. The app kept crashing before anything would render, so I dug into the library source.
What's Actually Wrong
Turns out
game:DefineFastFlag()needs a special permission calledRobloxScriptcapability. Only Roblox's internal server scripts have this - regular LocalScripts don't.The library tries to handle errors with
xpcall:But here's the catch: capability errors in Roblox can't be caught. Not by
pcall, not byxpcall. They just blow right past error handlers and kill your script.The Fix
Instead of trying to catch an uncatchable error, just check if we're in the right context first:
Why This Works Better
What I Tested
I verified this works with:
createRootand aScreenGuiNo errors, everything renders properly now.
Who This Affects
Anyone using React-Roblox in a client context - whether you're using roblox-ts or writing Luau directly.
What Changed:
modules/react-roblox/src/client/RobloxComponentProps.luaChange Type: