The code which maps the bindings over the shards can produce an empty chunk under some circumstances, which results in this thrown exception.
This can be fixed either by sending the empty chunk or by dropping it (my preference). The hard constraint is that we must count such chunks if we send them and must not count them (in messagesSent) if we do not, otherwise the query will not terminate correctly (messages out from the operator will not be balanced by messages consumed).
This looks like an easy fix in FederationChunkHandler at around line 501. If the chunk is empty, log an warning/error and then drop it. Only non-empty chunks should be sent and counted.