Encode group permissions as a 1-based array - #472
Merged
Cooldude2606 merged 1 commit intoSep 9, 2026
Conversation
encode_group_permissions filled the whitelist and blacklist starting at index 0. Factorio's table_to_json only serialises a table as a JSON array when its keys run 1..n, so the permissions reached the instance plugin as an object and every GroupUpdateRequest failed schema validation. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Cooldude2606
approved these changes
Sep 9, 2026
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.
Every in-game permission group edit with sync enabled logged
Error handling ipc event: Request exp_groups:GroupUpdateRequest failed validationon the host and never reached the controller.encode_group_permissionsfilled the whitelist and blacklist tables starting at index 0. Factorio'stable_to_jsononly treats a table as a JSON array when its keys run 1..n, so a zero-based table comes out as{"0":"a","1":"b"}. The instance plugin passed that object through toGroupPermissions, whose schema requires an array of strings, and the request was rejected before sending. The fix increments the counter before assigning so the tables are 1-based. The size comparison and the empty-list guards below are unchanged.I confirmed the serialisation with a throwaway scenario on headless 2.1.17:
{[0]="a",[1]="b",[2]="c"}encodes as{"1":"b","2":"c","0":"a"}while{"a","b","c"}encodes as["a","b","c"]. The bug has been present since the module was written.🤖 Generated with Claude Code