Hi @Peppe95 @alexandra,
are you sure that each key/column in the returned batch has the same number of elements?
You can check this by inserting the line:
assert set(len(column_values) for column_values in returned_batch.values()) == 1, "Mismatch in the number of elements"

before the return statement.
Let me know if this helps.