# Downloaded size does not match received message size

**URL:** <https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285>\
**Category:** troubleshooting\
**Created:** [July 5, 2025, 5:09am UTC](https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285 "2025-07-05T05:09:24Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![jammerdan](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/jammerdan/32/1121_2.png) [@jammerdan](https://forum.storj.io/u/jammerdan)\
**Post date:** [July 5, 2025, 5:09am UTC](https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285/1 "2025-07-05T05:09:24Z")

</div>

I am aware of the other topics [Downloaded size (0 bytes) does not match received message size (512 bytes)](https://forum.storj.io/t/downloaded-size-0-bytes-does-not-match-received-message-size-512-bytes/28331) and [Downloaded size and received size don’t match](https://forum.storj.io/t/downloaded-size-and-received-size-don-t-match/28219) where I even provided an answer myself.

However this one strikes me as like 99 out of 100 the received bytes is the same value of 262144 bytes out of 313600 bytes. In fact when it gets canceled for this reason it is at 99,85% with this specific byte value shown.

This appears strange to me as if there might be something to fix. Because even if the node might be slow, why does it get canceled pretty much always at the same byte figure?

---

<div class="post-metadata">

**Author:** ![Toyoo](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/toyoo/32/1126_2.png) [@Toyoo](https://forum.storj.io/u/Toyoo)\
**Post date:** [July 5, 2025, 5:39am UTC](https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285/2 "2025-07-05T05:39:28Z")

</div>

Bad sector on disk exactly at that place in a popular file?

---

<div class="post-metadata">

**Author:** ![Roxor](https://storj.bcdn.literatehosting.com/letter_avatar/roxor/32/6_449c533f586939b6e5f246632a46421f.png) [@Roxor](https://forum.storj.io/u/Roxor)\
**Post date:** [July 5, 2025, 5:51am UTC](https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285/3 "2025-07-05T05:51:59Z")

</div>

262144 bytes is exactly 256 kilobytes (256 x 1024) so perhaps that’s a common boundary to stop on?

---

<div class="post-metadata">

**Author:** ![Alexey](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/alexey/32/41_2.png) [@Alexey](https://forum.storj.io/u/Alexey)\
**Post date:** [July 5, 2025, 6:39am UTC](https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285/4 "2025-07-05T06:39:25Z")

</div>

The result of the cancelation on the client side.

However, checking the disk should not harm too.

---

<div class="post-metadata">

**Author:** ![jammerdan](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/jammerdan/32/1121_2.png) [@jammerdan](https://forum.storj.io/u/jammerdan)\
**Post date:** [July 5, 2025, 7:03am UTC](https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285/5 "2025-07-05T07:03:28Z")

</div>

Actually the download is successfully completed many times. So the sector/disk should be fine.  
However I have all kinds of error messages regarding this piece:

Download is canceled with: `"downloaded size does not match received message size"`, `"context canceled"`, `"stream closed by peer"` and even `unknown reason bug in code, please report`.

> [@Roxor](#):
>
> 262144 bytes is exactly 256 kilobytes (256 x 1024) so perhaps that’s a common boundary to stop on?

Interesting…  
Other values I see are e.g. 294912 bytes, 278528 bytes, 0 bytes, 311296 bytes. But these are only like 0,15% currently. To me it weird that it is so massively concentrated on that 262144 bytes value where it gets canceled.

---

<div class="post-metadata">

**Author:** ![Toyoo](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/toyoo/32/1126_2.png) [@Toyoo](https://forum.storj.io/u/Toyoo)\
**Post date:** [July 5, 2025, 3:30pm UTC](https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285/6 "2025-07-05T15:30:32Z")

</div>

Is this a single piece or many different pieces?

---

<div class="post-metadata">

**Author:** ![jammerdan](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/jammerdan/32/1121_2.png) [@jammerdan](https://forum.storj.io/u/jammerdan)\
**Post date:** [July 5, 2025, 8:54pm UTC](https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285/7 "2025-07-05T20:54:32Z")

</div>

This is for a specific piece.

---

<div class="post-metadata">

**Author:** ![Toyoo](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/toyoo/32/1126_2.png) [@Toyoo](https://forum.storj.io/u/Toyoo)\
**Post date:** [July 5, 2025, 9:11pm UTC](https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285/8 "2025-07-05T21:11:05Z")

</div>

> [@jammerdan](#):
>
> Actually the download is successfully completed many times. So the sector/disk should be fine.

A bad sector may be a soft error (meaning: sometimes works, sometimes not), and then a successfully read sector is cached (so at least for some time queries succeed).

Alternatively, the link between the specific customer who repeatedly downloads the piece and you is occasionally slow, and the specific size is just the amount of data that your node manages to send before getting informed about the lost race. The fact the number repeats might just come from the TCP slow start or buffer bloat effects in devices close to you.

I wouldn’t care much about the latter if in general your node performs well. And bad reads will be visible in SMART data, so it’s easy to check. Might be just as well something else, these two I would say are the most probable though.

---

<div class="post-metadata">

**Author:** ![Alexey](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/alexey/32/41_2.png) [@Alexey](https://forum.storj.io/u/Alexey)\
**Post date:** [July 6, 2025, 3:27am UTC](https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285/9 "2025-07-06T03:27:04Z")

</div>

> [@jammerdan](#):
>
> `unknown reason bug in code, please report`.

Please copy a full error message with a stack trace.

---

<div class="post-metadata">

**Author:** ![jammerdan](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/jammerdan/32/1121_2.png) [@jammerdan](https://forum.storj.io/u/jammerdan)\
**Post date:** [July 6, 2025, 4:49pm UTC](https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285/10 "2025-07-06T16:49:23Z")

</div>

> [@Alexey](#):
>
> copy a full error message with a stack trace.

The node is running on info level. I think there is not stack trace on that level.

> [@Toyoo](#):
>
> the specific size is just the amount of data that your node manages to send before getting informed about the lost race.

That was the initial answer. However the repeated appearance of the same byte number at which the race is lost appears to be far from random which is what I would have expected.

---

<div class="post-metadata">

**Author:** ![Toyoo](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/toyoo/32/1126_2.png) [@Toyoo](https://forum.storj.io/u/Toyoo)\
**Post date:** [July 6, 2025, 5:28pm UTC](https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285/11 "2025-07-06T17:28:06Z")

</div>

> [@jammerdan](#):
>
> That was the initial answer. However the repeated appearance of the same byte number at which the race is lost appears to be far from random which is what I would have expected.

You would be surprised how repeated some measurements can be over computer networks. The canonical case study is the [500-mile email story](https://web.mit.edu/jemorris/humor/500-miles).

---

<div class="post-metadata">

**Author:** ![ifraixedes](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/ifraixedes/32/71_2.png) [@ifraixedes](https://forum.storj.io/u/ifraixedes)\
**Post date:** [July 7, 2025, 10:26am UTC](https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285/12 "2025-07-07T10:26:49Z")

</div>

I opened an issue to try to identify which other errors aren’t classified on the storagenode download path and provide a proper informative message for them [storagenode reports info message "unknown reason bug in code, please report" · Issue #7534 · storj/storj · GitHub](https://github.com/storj/storj/issues/7534)

This specific error message was introduced by me in commit [storagenode/piecestore: Add reason download cancellation · storj/storj@3ca9625 · GitHub](https://github.com/storj/storj/commit/3ca962531acfbd355c1fe6d0ad64cfb6908e5112)

When I inspected the code, I didn’t find more specific error message out of the ones classified in the `switch` statement. I added a default branch to it to prints out this message in case that aren’t identified errors. Now that’s appearing, we should revisit to see if we can identify other errors and provide an informative message for each of them.

---

<div class="post-metadata">

**Author:** ![jammerdan](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/jammerdan/32/1121_2.png) [@jammerdan](https://forum.storj.io/u/jammerdan)\
**Post date:** [July 7, 2025, 2:14pm UTC](https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285/13 "2025-07-07T14:14:54Z")

</div>

> [@ifraixedes](#):
>
> I opened an issue to try to identify which other errors aren’t classified on the storagenode download path and provide a proper informative message for them [storagenode reports info message “unknown reason bug in code, please report” · Issue #7534 · storj/storj · GitHub](https://github.com/storj/storj/issues/7534)

Just to add for for information:  
I see this error on other nodes as well: `download_cancel_unknown_reason_v1{action="GET",scope="storj_io_storj_storagenode_piecestore",field="high"} 899`

---

<div class="post-metadata">

**Author:** ![Toyoo](https://storj.bcdn.literatehosting.com/user_avatar/forum.storj.io/toyoo/32/1126_2.png) [@Toyoo](https://forum.storj.io/u/Toyoo)\
**Post date:** [July 7, 2025, 9:11pm UTC](https://forum.storj.io/t/downloaded-size-does-not-match-received-message-size/30285/14 "2025-07-07T21:11:44Z")

</div>

Yeah, seeing it on a regular basis as well.
