# Fetch multiple messages from disk

**URL:** <https://forum.codecrafters.io/t/fetch-multiple-messages-from-disk/9627>\
**Category:** Challenges\
**Tags:** challenge:kafka\
**Created:** [April 29, 2025, 2:19pm UTC](https://forum.codecrafters.io/t/fetch-multiple-messages-from-disk/9627 "2025-04-29T14:19:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mingo023](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/mingo023/32/9787_2.png) [@mingo023](https://forum.codecrafters.io/u/mingo023)\
**Post date:** [April 29, 2025, 2:19pm UTC](https://forum.codecrafters.io/t/fetch-multiple-messages-from-disk/9627/1 "2025-04-29T14:19:46Z")

</div>

I am getting the error for final stage.

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/9/9527bcd991a155565dadaba80d7d7718bcd6fb89.jpeg)

Here is the my code: [codecrafter/build-your-own-kafka/app/api/fetch/fetch\_response.go at main · mingo023/codecrafter · GitHub](https://github.com/mingo023/codecrafter/blob/main/build-your-own-kafka/app/api/fetch/fetch_response.go)

I save we had new changes for `byte count calculation in PartitionResponse decoding` [fix: adjust byte count calculation in PartitionResponse decoding · codecrafters-io/kafka-tester@b097661 · GitHub](https://github.com/codecrafters-io/kafka-tester/commit/b097661b45a57bf81272bb7014adfcf607c2a8a8). I believe it should be a problem.

Could anyone help me to figure out the problems?

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [April 30, 2025, 8:35am UTC](https://forum.codecrafters.io/t/fetch-multiple-messages-from-disk/9627/4 "2025-04-30T08:35:50Z")

</div>

Hey @mingo023, there might be a few things at play. The first one I noticed is that `.compact_records_length` is incorrect.

It should represent the number of bytes in the raw `RecordBatch` , not the length of the `RecordBatch` array.

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/4/4388f7b87f4ab8fa0451b13f39b09ac402a0e066.jpeg)

Let me know if you’d like further clarification!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [May 5, 2025, 8:36am UTC](https://forum.codecrafters.io/t/fetch-multiple-messages-from-disk/9627/6 "2025-05-05T08:36:01Z")

</div>

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
