{"record":{"id":"31005fd2050bedd9","repo":"oven-sh/bun","slug":"unhandled-out-of-memory-error-in-breakoutputintopi","errorCode":null,"errorMessage":"Unhandled out of memory error in breakOutputIntoPieces()","messagePattern":"Unhandled out of memory error in breakOutputIntoPieces\\(\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/bundler/linker_context/postProcessJSChunk.rs","lineNumber":680,"sourceCode":"        }\n        j.push_static(c.options.footer);\n        line_offset.advance(c.options.footer);\n        j.push_static(b\"\\n\");\n        line_offset.advance(b\"\\n\");\n    }\n\n    // SAFETY: every borrowed node in `j` points into `chunk.compile_results_for_chunk`\n    // (slots pre-sized in generateChunksInParallel, filled in place by the print\n    // workers before post-processing, never reassigned afterwards), `c.options`\n    // banner/footer (`&'static`), graph/parse-graph data (hashbangs, source paths,\n    // HMR runtime), or `'static` literals; `watcher.input` is `chunk.unique_key`\n    // (`&'static`). All of these outlive the joiner stored in\n    // `chunk.intermediate_output`, which is only read while the chunk and the\n    // linker graph are alive.\n    let mut j = unsafe { j.detach_lifetime() };\n    chunk.intermediate_output = c\n        .break_output_into_pieces(worker_arena, &mut j, ctx.chunks.len() as u32)\n        .unwrap_or_else(|_| panic!(\"Unhandled out of memory error in breakOutputIntoPieces()\"));\n\n    // TODO: meta contents\n\n    chunk.isolated_hash = c.generate_isolated_hash(chunk, worker_arena);\n    chunk\n        .flags\n        .set(crate::chunk::Flags::IS_EXECUTABLE, is_executable);\n\n    if c.options.source_maps != options::SourceMapOption::None {\n        let can_have_shifts = matches!(\n            chunk.intermediate_output,\n            crate::chunk::IntermediateOutput::Pieces(_)\n        );\n        // Copy the `ParentRef` out (not `c.resolver()`) so the arg borrows the\n        // local, not `c`, avoiding the split-borrow with\n        // `c.generate_source_map_for_chunk(&mut self, …)`.\n        let resolver = c.resolver.expect(\"resolver set in load()\");\n        chunk.output_source_map = c.generate_source_map_for_chunk(","sourceCodeStart":662,"sourceCodeEnd":698,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/bundler/linker_context/postProcessJSChunk.rs#L662-L698","documentation":"Error \"Unhandled out of memory error in breakOutputIntoPieces()\" thrown in oven-sh/bun.","triggerScenarios":"Thrown at src/bundler/linker_context/postProcessJSChunk.rs:680 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}