See the mod Spaceblock: https://mods.factorio.com/mod/spaceblock .
There is a beacon called "spaceblock-mining-prod-provider". If one tries e.g /c game.print(game.entity_prototypes["spaceblock-mining-prod-provider"].module_inventory_size) the return is nil. The prototype explorer shows the right value, and the beacon works fine in game. I increased mining productivity (how the mod works) and it can hold 65535 modules (after waiting a while). I can set player.opened to it and interaction works.
Asked in the official Discord #mod-making, and justarandomgeek said '65535 specifically is NO_ITEM_STACK_INDEX', and this may affect other inventories than only the beacon.
[boskid] [1.1.34] 65535 slot beacon has nil slots via prototype
[boskid] [1.1.34] 65535 slot beacon has nil slots via prototype
I have mods! I guess!
Link
Link
Re: [boskid] [1.1.34] 65535 slot beacon has nil slots via prototype
Indeed the NO_ITEM_STACK_INDEX caused this. Fixed for next release.