You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug in fileHandle.readableWebStream implementation #58817
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
I do not expect to get an exception.
What do you see instead?
I do get the following exception:
node:internal/fs/promises:689
validateOffsetLengthRead(offset, length, buffer.byteLength);
^
RangeError [ERR_OUT_OF_RANGE]: The value of "length" is out of range. It must be <= -1. Received 1
at read (node:internal/fs/promises:689:3)
at fsCall (node:internal/fs/promises:467:18)
at FileHandle.read (node:internal/fs/promises:199:12)
at Object.pull (node:internal/fs/promises:322:37)
at invokePromiseCallback (node:internal/webstreams/util:172:10)
at Object.<anonymous> (node:internal/webstreams/util:177:23)
at readableByteStreamControllerCallPullIfNeeded (node:internal/webstreams/readablestream:3145:24)
at node:internal/webstreams/readablestream:3295:7 {
code: 'ERR_OUT_OF_RANGE'
}
Node.js v24.2.0
Additional information
There seems to be a bug in line 321 of "node/lib/internal/fs/promises.js". The line currently looks like this:
I do not understand what you want me to do, please clarify.
As I already wrote above, in my opinion the bug is located in line 321 of "node/lib/internal/fs/promises.js". I did fix this in my local fork of node, added a test, and the test passes:
Yes, you are right, I thought wrong for a moment, I thought that this problem was in return ByteOffset and that we should not solve it on the cpp side, but what you said seems healthy to me.
This issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
This issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 240 days).
If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.
Activity
juanarbol commentedon Jun 24, 2025
Are you going to fix it?
mertcanaltin commentedon Jun 25, 2025
@pdaehne hello would you like to open Pr for this place:
In BYOB reader, the view with offset already comes, and
is automatically offset.
Return only the base pointer from Buffer::Data() and let the
view handle its own offset:
pdaehne commentedon Jun 26, 2025
I do not understand what you want me to do, please clarify.
As I already wrote above, in my opinion the bug is located in line 321 of "node/lib/internal/fs/promises.js". I did fix this in my local fork of node, added a test, and the test passes:
https://github.com/pdaehne/node/commit/f6dfeb4a1eca98344e7e99e5862d9b6fa310abbc
I'm perfectly ok with creating a pull request with that fix.
I also tried your change in line 253 of "node/src/node_buffer.cc". It does not fix my problem, and it does not pass the test.
https://github.com/pdaehne/node/commit/6b9d3ef8c13de1a6b8cdc7e9b3457e05ac24e4b0
Obviously I will not create a pull request with a fix that does not work.
mertcanaltin commentedon Jun 26, 2025
Yes, you are right, I thought wrong for a moment, I thought that this problem was in return ByteOffset and that we should not solve it on the cpp side, but what you said seems healthy to me.
pdaehne commentedon Jun 26, 2025
Ok, I did create a PR for my fix.
github-actions commentedon Apr 19, 2026
This issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
github-actions commentedon May 19, 2026
This issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 240 days).
If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.
lib: fix for FileHandle.readableWebStream
lib: fix for FileHandle.readableWebStream
lib: fix for FileHandle.readableWebStream
lib: fix for FileHandle.readableWebStream