PANE

Bun developers face stale bytes after file truncation

16 posts in the last 60 days, all from GitHub.

“What version of Bun is running? Bun 1.4.3, revision c6da4a4d3010e5553438c60f6bd76d981976867c. What platform is your computer? Windows 11 Pro, version 10.0.26300, x64. What steps can reproduce the bug? I originally encountered this issue when calling consola.prompt() with type…”
GitHub
“What version of Bun is running? 1.4.3+c6da4a4d3 What platform is your computer? Linux 7.2.6+deb14 amd64 x86 64 unknown What steps can reproduce the bug? Create repro.ts: Run: Expected output size: Actual output on the affected system: The actual output is exactly: A byte level…”
GitHub
“What version of Bun is running? 1.2.0 What platform is your computer? Darwin 24.2.0 arm64 arm What steps can reproduce the bug? 1. Create a file in / 2. In example.ts : 3. Run example.ts from / : The output is: What is the expected behavior? Passing an absolute path (like…”
GitHub

Users report Bun's `fs.promises.writeFile` function silently succeeding when final truncation fails, leaving behind stale trailing bytes in files. This issue occurs on both Windows and macOS, impacting the reliability of file writing operations.

devtoolsprogrammingfile-managementosbug
FIT
0%
SIGNAL
57%
SOURCES31
FRESHEST POST12D AGO
TRACKED SINCE81D AGO

SOURCES (31)

“What version of Bun is running? 1.4.6 canary.1+b15f51302 What platform is your computer? Darwin 27.2.0 arm64 arm What steps can reproduce the bug? What is the expected behavior? The file is read as an oxlint config, as oxlint c lint.custom.ts a.ts (1.94.0) does, and as…”

GITHUB12d ago

“What version of Bun is running? 1.4.4 (Windows x64). Not yet tried on 1.4.5; its release notes do not mention node:net or named pipes. What platform is your computer? Windows 11 x64 (build 26300) What steps can reproduce the bug? Save as chain.mjs and run bun chain.mjs pipe , then bun chain.mjs tcp : What is the expected behavior? After 3 s it prints a line and exits, as it does over TCP on Bun and over both transports on Node 24.21.0: What do you see instead? bun chain.mjs pipe prints nothing a”

GITHUB14d ago

“What version of Bun is running? 1.4.5+a7733435c What platform is your computer? Linux 6.8.0 149 generic x86 64 x86 64 (ext4, glibc 2.35) What steps can reproduce the bug? A writer repeatedly saves a regular file by writing a temporary file in the same directory and renaming it over the destination (an atomic replacement, as editors commonly do). A reader calls realpath on the destination while this runs. Save as repro.mjs and run bun repro.mjs (optional argument: duration in ms, default 3000). R”

GITHUB14d ago

“What version of Bun is running? 1.4.4 What platform is your computer? GitHub Actions windows latest runner (NTFS) What steps can reproduce the bug? Several processes remove the same file at the same moment with a non recursive fs.promises.rm(path, { force: true }) . I have no Windows machine, so this script is written from the source reading below and has not been run by me. Start it in four processes at once in one directory: What I did observe is this, in CI: 21 Bun processes contend for a loc”

GITHUB20d ago

“What version of Bun is running? 1.4.4+38afee6c8 (also reproduced on 1.4.0, 1.4.1, 1.4.2 and 1.4.3; 1.3.14 is not affected) What platform is your computer? Microsoft Windows NT 10.0.26300.0 x64 What steps can reproduce the bug? On Windows, fs.writeFileSync (and fs.promises.writeFile ) report success but leave the old tail of the file in place when another handle holds a mapped view of it. Any process that maps the file triggers this, for example Git for Windows, which mmap s worktree files while”

GITHUB28d ago

“What version of Bun is running? 1.4.4 (macOS 27.0.1, arm64) What steps can reproduce the bug? fs.promises.writeFile given an iterable of Uint8Array chunks writes a longer file than the chunks add up to. The extra bytes are zeros at the end of the file. What is the expected behavior? As on Node v24.21.0: What do you see instead? Additional information We found this running bun bun expo prebuild (Expo SDK 58). Prebuild copies the Android template's gradle/wrapper/gradle wrapper.jar this way. Under”

GITHUBNov 3

“What version of Bun is running? 1.4.4+38afee6c8 (also seen on 1.4.2) What platform is your computer? Windows 11 Pro 10.0.26200, x64 What steps can reproduce the bug? Run this inside an empty scratch directory that holds one file. It deletes the contents of the current working directory , so do not run it anywhere else. What is the expected behavior? An empty path names no file, so nothing is removed and the call throws ENOENT . That is what Node v25.9.0 does for the same script: it throws ENOENT”

GITHUBOct 30

“Bun 1.4.4 (38afee6c8), Linux x64; also observed in a macOS 26 CI run. Node 26.12.1 passes the same reduced reproduction. A failed pipeline(source, gzip, asyncGeneratorStage, fsWriteStream) can reject while the destination is still opening/closing. Atomic write cleanup immediately after rejection may see ENOENT, then find the temporary file created after cleanup. This broke a backup failure cleanup assertion in our CI job. The example uses only Node APIs, at most 20 tiny sequential attempts, owne”

GITHUBOct 29

“What version of Bun is running? 1.4.4+38afee6c8 What platform is your computer? Darwin 27.0.0 arm64 arm What steps can reproduce the bug? test.js: What is the expected behavior? (e.g. what you get by changing setImmediate(wrongfunction) to wrongfunction() so that it runs synchronously) What do you see instead? It points to the re throw point, not the actual error point. Additional information I was kind of surprised that even Node gets this wrong, it prints the right stack trace (albeit includin”

GITHUBOct 28

“What version of Bun is running? 1.3.14 (also observed on 1.4.4) What platform is Bun running on? Linux arm64 (Ubuntu 24.04) What did you do? What did you expect to see? 8 — the file contains payload\n . What did you see instead? 0 — the file exists and is empty. Exit code is 0. Isolation Only the empty write to the Bun.stderr sink triggers it, and only when stderr is redirected into the same file as stdout: | program | redirect | bytes | | | | | | console.log('payload'); await Bun.write(Bun.stde”

GITHUBOct 26

“What version of Bun is running? Bun 1.4.3, revision c6da4a4d3010e5553438c60f6bd76d981976867c. What platform is your computer? Windows 11 Pro, version 10.0.26300, x64. What steps can reproduce the bug? I originally encountered this issue when calling consola.prompt() with type: "select" in consola@3.4.2 on Windows. The interactive menu appeared, then failed with the EPIPE error shown above. The dependency free reproduction in this report was extracted while investigating that failure. Run the fol”

GITHUBOct 20

“What version of Bun is running? 1.4.3+c6da4a4d3 What platform is your computer? Linux 7.2.9 (WSL2, x86 64) What steps can reproduce the bug? The figure in the title is a median difference. The min max ranges of the two runtimes overlap on this shared host (load 3 to 4). A rank sum test over 24 alternating rounds separates them (p <= 0.0001 on all six rows). Save as repro.mjs , then run node repro.mjs and bun repro.mjs alternately, at least 10 times each, and compare medians: What is the expected”

GITHUBOct 17

“What version of Bun is running? 1.4.3+c6da4a4d3 What platform is your computer? Linux 7.2.6+deb14 amd64 x86 64 unknown What steps can reproduce the bug? Create repro.ts: Run: Expected output size: Actual output on the affected system: The actual output is exactly: A byte level check: Observed: The prefix is duplicated once. The same program is correct when stdout is a regular file: Observed: The problem is specific to the pipe/nonblocking stdout path. What is the expected behavior? A partial std”

GITHUBOct 17

“What version of Bun is running? 1.4.3 (also 1.4.0, 1.3.13), macOS arm64 What steps can reproduce the bug? What is the expected behavior? "loXYm ipsum" , which is what Node prints. Node treats an undefined offset as 0 and a non number length as buffer.byteLength offset , then writes at position . What do you see instead? "XYrem ipsum" . The write goes to the descriptor's current offset, and position is ignored. This affects both fs.write and fs.writeSync whenever offset is undefined or length is”

GITHUBOct 16

“What version of Bun is running? 1.4.2 (744846f84), x64 What platform is your computer? Windows 11 Pro 10.0.28000 x64 What steps can reproduce the bug? Save this as repro.test.ts (dependency free — uses bun:test and node:child process only) and run bun test repro.test.ts : What is the expected behavior? Both tests pass. The child process writes resp2\n to stdout about 5 ms after req2 is written to its stdin, so in both tests the promise p should reject with boom resp2 . What do you see instead? T”

GITHUBOct 16

“What version of Bun is running? 1.4.2 ( oven/bun:1 ) What platform is your computer? Linux x86 64, inside a gVisor (runsc release 20260928.0) sandbox What steps can reproduce the bug? fs.rm(path, { recursive: true, force: true }) on a path that doesn't exist, written with a trailing slash, on a filesystem where unlink() of that path returns ENOTDIR instead of ENOENT : Under gVisor, unlink("/src/.output/") returns ENOTDIR for a missing path (gVisor bug, reported at google/gvisor 15303), while lst”

GITHUBOct 5

“What version of Bun is running? 1.4.3 canary.1+37da174d5 What platform is your computer? Darwin 27.0.0 arm64 arm What steps can reproduce the bug? lastModified returns Bun's internal lazy stat marker jsc::INIT TIMESTAMP ( (1u64 << 52) 1 , or 4503599627370495 ) instead of a timestamp. Two code paths reach it: 1. Bun.file(path) where the stat fails (the file does not exist). 2. Any in memory Blob . Save as repro.js and run bun repro.js : What is the expected behavior? For a Bun.file() whose stat f”

GITHUBSep 27

“What version of Bun is running? 1.4.2+744846f84 (also main at 367d939d9a) What platform is your computer? Linux x64 (the code path is the same on every platform) What steps can reproduce the bug? A node:http server answers a request. The client then sends an Upgrade request (or a CONNECT) on the same keep alive connection. The 'upgrade' listener writes the 101 to the socket. Run the script with node and with bun . What is the expected behavior? Node v26.3.0 sends the 101 at once: What do you see”

GITHUBSep 18

“What version of Bun is running? 1.4.3+047f2e8e6 What platform is your computer? Darwin 27.0.0 arm64 arm What steps can reproduce the bug? Use the attached README.md , run repro.py , preload.cjs , and trace.c . The runner checks a normal write and an injected truncation failure against each supplied macOS arm64 Claude Code binary. 1. Write a 534 byte JSON string with await fs.writeFile(path, longer) . 2. Overwrite it with a 533 byte JSON string using await fs.writeFile(path, shorter) . 3. Make th”

GITHUBSep 13

“What version of Bun is running? 1.4.2+744846f84 What platform is your computer? Microsoft Windows NT 10.0.26200.0 x64 What steps can reproduce the bug? A Windows drive root is the one path fs.promises.realpath gets wrong: it comes back drive relative ( C: ) instead of C:\ . What is the expected behavior? All of them return "C:\\" , and the result is still a usable root. Node v26.8.1: C:\ is a fixed point of this operation, and Node pins that behavior rather than leaving it to chance: fs.realpath”

GITHUBSep 13

“What version of Bun is running? 1.4.2+744846f84 What platform is your computer? Microsoft Windows NT 10.0.26200.0 x64 What steps can reproduce the bug? Try to use aes 256 ocb in crypto.createCipheriv : What is the expected behavior? Working aes 256 ocb encryption. What do you see instead?”

GITHUBSep 13

“Bun version Reproduced: Bun 1.4.2 ( 744846f844374847c902b5e7fd59b4342a51ef99 ). Comparison: Bun 1.3.14 ( 0d9b296af33f2b851fcbf4df3e9ec89751734ba4 ). Both are official Windows binaries, tested on the same machine. A canary or locally patched Bun build has not been tested. Platform Windows 10 22H2 x64, build 19045, local filesystem. The same operation sequence did not reproduce on macOS ARM64 with either version. Summary On Windows 1.4.2, a single FileSink.write() returns a number and the immediat”

GITHUBSep 12

“What version of Bun is running? 1.3.14+0d9b296af What platform is your computer? Microsoft Windows NT 10.0.26200.0 x64 What steps can reproduce the bug? Try to use aes 256 ocb in crypto.createCipheriv . What is the expected behavior? Working aes 256 ocb encryption. What do you see instead? error: Unknown cipher: aes 256 ocb Additional information AES OCB Added in node Node.js 24.7.0 : https://nodejs.org/fr/blog/release/v24.7.0”

GITHUBJun 19

“What version of Bun is running? 1.3.11 What platform is your computer? macOS 26.3.1 What steps can reproduce the bug? This is similar to https://github.com/oven sh/bun/issues/10304 but for the new Bun.cron(…) API. What is the expected behavior? I can pass in the output of a successful import.meta.resolve(…) invocation. What do you see instead? This fails with TypeError: Failed to resolve path Additional information The docs specify: Path to the script to run (resolved relative to caller) This is”

GITHUBMar 20

“What version of Bun is running? 1.3.8 What platform is your computer? Darwin 24.6.0 arm64 arm What steps can reproduce the bug? The local directory and file does not exist. What is the expected behavior? s3.file('xx') as the second param make sense What do you see instead? No response Additional information No response”

GITHUBFeb 6

“What version of Bun is running? 1.3.1 What platform is your computer? Microsoft Windows NT 10.0.26100.0 x64 What steps can reproduce the bug? Calling fs.readdir() from node:fs/promises will cause the next query (of any kind) to hang indefinitely 99% of the time. This occurs even with a freshly created table with minimal data, and on any query (transactions, selects, inserts, etc). The call to fs.readdir is returning without error, and sequential code executes. Reproducible with the following cod”

GITHUBOct 2025

“What version of Bun is running? 1.3.1 canary.75+de4a5a07b What platform is your computer? Darwin 25.0.0 arm64 arm What steps can reproduce the bug? When writing data to a file using Bun.file().writer(), if the total data written exceeds the available disk space, the error is not thrown during the write() calls. The error should be thrown when writer.end() is called to flush the buffered data. However, instead of throwing a catchable JavaScript exception from await writer.end(), the ENOSPC ("no s”

GITHUBOct 2025

“What version of Bun is running? 1.2.20 What platform is your computer? Darwin 24.6.0 arm64 arm What steps can reproduce the bug? Hi, I am trying to create an executable with the following command: bun build compile target=bun darwin arm64 outfile ./build/server sourcemap=inline ./src/program.ts ../../apps/ /dist My intention is to embed the dist folders using the glob path ../../apps/ /dist. However, the build fails with the following error: error: ModuleNotFound resolving "../../apps/app dienst”

GITHUBAug 2025

“What version of Bun is running? 1.2.19+aad3abead What platform is your computer? Darwin 24.3.0 arm64 arm What steps can reproduce the bug? What is the expected behavior? One of two mutually exclusive behaviors. Option 1: .exists is changed to return true for directories, for consistency with .stat . Partial compatibility of BunFile with directories gets documented. Option 2: .size and .stat are artificially restricted to files only. Personally, I'm fine with either. Other things being equal, I'd”

GITHUBAug 2025

“What version of Bun is running? 1.2.0 What platform is your computer? Darwin 24.2.0 arm64 arm What steps can reproduce the bug? 1. Create a file in / 2. In example.ts : 3. Run example.ts from / : The output is: What is the expected behavior? Passing an absolute path (like /Users/adam/foo ) should work. What do you see instead? Glob.scan does not find files when given an absolute path. Additional information Looks like this was previously an issue that was fixed? https://github.com/oven sh/bun/di”

GITHUBJan 2025

“What version of Bun is running? 1.1.26+0a37423ba What platform is your computer? Darwin 24.0.0 arm64 arm What steps can reproduce the bug? Run the following: What is the expected behavior? bun writes the contents of stdin to foo.txt . What do you see instead? ENOTSUP: Operation not supported errno: 45 syscall: "fcopyfile" Additional information No response”

GITHUBSep 2024

SOLUTION LANDSCAPE

Brought to you byTop Sectors

A Player feature.See how many ways this pain can be solved, who's already building, and where the gaps are.

Related panes

/ same corner of the problem