{"record":{"id":"cf3562f91d0a94ac","repo":"oven-sh/bun","slug":"not-implemented-right","errorCode":null,"errorMessage":"not implemented right","messagePattern":"not implemented right","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"bench/emitter/realworld_stream.mjs","lineNumber":58,"sourceCode":"      recived.push(req);\n    });\n\n    stream.on(\"end\", ev => {\n      ev.preventDefault();\n    });\n\n    // simulate a stream\n    stream.emit(\"start\", { status: 200 });\n    for (let chunk of chunks) {\n      stream.emit(\"data\", chunk);\n    }\n    stream.emit(\"end\", {\n      preventDefault() {\n        id++;\n      },\n    });\n\n    if (id !== 1) throw new Error(\"not implemented right\");\n    if (recived.length !== 1024) throw new Error(\"not implemented right\");\n  });\n});\n\nawait run();\n","sourceCodeStart":40,"sourceCodeEnd":64,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/bench/emitter/realworld_stream.mjs#L40-L64","documentation":"Generic write/IO failure in install-related code. Notably every `std::io::Error` inside the install crate converts to this variant (From impl at src/install/error.rs:420-424), and commands that emit JSON map write errors to it (e.g. src/runtime/cli/pm_pkg_command.rs:229). Printing a lockfile treats WriteFailed/BrokenPipe as benign (src/install/lockfile.rs:1646).","triggerScenarios":"Disk full or quota exceeded while writing node_modules, bun.lock, or cache files; permission denied on the target directory; stdout/stderr closed early by a consumer during a command that writes output.","commonSituations":"Full CI disks or container size limits; read-only workspace mounts; project or cache dir owned by another user (root via sudo bun); piping command output to `head`.","solutions":["Check free space and write permissions on the project dir and cache dir (`df -h`, `ls -ld . ~/.bun/install/cache`)","Free space / fix ownership, then rerun the command","If it only happens when piping to `head`, note the lockfile printer already swallows it - otherwise avoid closing the pipe early","In Docker/CI, ensure the workspace volume is writable by the bun user"],"exampleFix":"# before\n$ sudo bun install   # node_modules owned by root\n$ bun install         # WriteFailed for later runs\n\n# after\n$ sudo chown -R $(id -u):$(id -g) node_modules && bun install","handlingStrategy":"validation","validationCode":"import { statfsSync, accessSync, constants } from \"node:fs\";\nfunction canInstall(dir = process.cwd()) {\n  accessSync(dir, constants.W_OK);\n  const { bavail, bsize } = statfsSync(dir);\n  return bavail * bsize > 500 * 1024 * 1024; // require >=500MB free\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Preflight free disk space and write permissions on the project + cache dirs","Never run bun install via sudo; fix directory ownership instead","Give CI runners adequate disk so installs do not fail mid-write"],"tags":["io","filesystem","install","permissions"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}