Skip to content

Encode group permissions as a 1-based array - #472

Merged
Cooldude2606 merged 1 commit into
explosivegaming:mainfrom
bbassie:fix/group-permissions-json-array
Sep 9, 2026
Merged

Encode group permissions as a 1-based array#472
Cooldude2606 merged 1 commit into
explosivegaming:mainfrom
bbassie:fix/group-permissions-json-array

Conversation

@bbassie

@bbassie bbassie commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Every in-game permission group edit with sync enabled logged Error handling ipc event: Request exp_groups:GroupUpdateRequest failed validation on the host and never reached the controller.

encode_group_permissions filled the whitelist and blacklist tables starting at index 0. Factorio's table_to_json only 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 to GroupPermissions, 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

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
Cooldude2606 merged commit 24efb82 into explosivegaming:main Sep 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants