bun
bun copied to clipboard
Error deleting file: Operation not permitted
How can we reproduce the crash?
JS Snippet
import fs from "fs";
import path from "path";
import express from "express";
import cors from "cors";
import helmet from "helmet";
import dotenv from "dotenv";
import morgan from "morgan";
import axios from "axios";
import unzipper from "unzipper";
const icon_urls = [
// download all icons and save to icon folder
"https://phosphoricons.com/assets/phosphor-icons.zip",
];
// make icon folder, if it doesn't exist
if (!fs.existsSync("./icon")) {
fs.mkdirSync("./icon");
}
// delete all files in icon folder
fs.readdirSync("./icon").forEach((file) => {
try {
fs.unlinkSync(path.join("./icon", file));
} catch (err) {
console.error(`Error deleting file ${file}: ${(err as Error).message}`);
}
});
console.log("Downloading icons!");
for (const url of icon_urls) {
const response = await axios.get(url, { responseType: "arraybuffer" });
const buffer = Buffer.from(response.data, "binary");
const filename = url.split("/").pop() as string;
const file = await Bun.file(`./icon/${filename}`);
const writer = await file.writer();
await writer.write(buffer);
// if file is zipped, extract it
if (filename.endsWith(".zip")) {
const directory = await unzipper.Open.file(`./icon/${filename}`);
await directory.extract({ path: "./icon" });
}
}
dotenv.config();
const app = express();
app.use(cors());
app.use(helmet());
app.use(morgan("dev"));
app.get("/", async (req, res) => {
res.json({
message: "Hello, world!",
});
});
app.listen(3000, () => {
console.log("Server is running on port 3000");
});
Relevant log output
$ bun run --watch index.ts
Error deleting file Fonts: Operation not permitted
Error deleting file SVGs Flat: Operation not permitted
Downloading icons!
============================================================
Bun v1.1.40 (b5b51004) Windows x64
Windows v.win10_fe
CPU: sse42 avx avx2
Args: "bun" "run" "--watch" "index.ts"
Features: fetch jsc tsconfig(15)
Builtins: "bun:main" "node:assert" "node:async_hooks" "node:buffer" "node:constants" "node:crypto" "node:events" "node:fs" "node:http" "node:https" "node:net" "node:os" "node:path" "node:querystring" "node:stream" "node:string_decoder" "node:tty" "node:url" "node:util" "node:util/types" "node:zlib"
Elapsed: 14009ms | User: 4734ms | Sys: 3515ms
RSS: 0.83GB | Peak: 0.83GB | Commit: 1.05GB | Faults: 243609
panic(main thread): Segmentation fault at address 0x0
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:
https://bun.report/1.1.40/wr1b5b5100Ahg87//DA2AA
--- Bun is auto-restarting due to crash [time: 1734578455625] ---
Error deleting file Fonts: Operation not permitted
Error deleting file SVGs Flat: Operation not permitted
Downloading icons!
============================================================
Bun v1.1.40 (b5b51004) Windows x64
Windows v.win10_fe
CPU: sse42 avx avx2
Args: "bun" "run" "--watch" "index.ts"
Features: fetch jsc tsconfig(15)
Builtins: "bun:main" "node:assert" "node:async_hooks" "node:buffer" "node:constants" "node:crypto" "node:events" "node:fs" "node:http" "node:https" "node:net" "node:os" "node:path" "node:querystring" "node:stream" "node:string_decoder" "node:tty" "node:url" "node:util" "node:util/types" "node:zlib"
Elapsed: 12330ms | User: 2921ms | Sys: 2343ms
RSS: 0.78GB | Peak: 0.78GB | Commit: 0.97GB | Faults: 224464
panic(main thread): cast causes pointer to be null
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:
https://bun.report/1.1.40/wr1b5b5100Ahg87//Dwx6kNqivvrB8nxwrB6+uwrB2g+sMk/79G29jimBkv/8F6xo9F0z+gGA0eNpLTiwuUUhOLC1OLVYoyM/MK0ktUijJV0hKVcgrzckBAK96CzY
--- Bun is auto-restarting due to crash [time: 1734578468069] ---
Error deleting file Fonts: Operation not permitted
Error deleting file SVGs Flat: Operation not permitted
Downloading icons!
Stack Trace (bun.report)
Bun v1.1.40 (b5b5100
) on windows x86_64 [RunCommand]
panic: cast causes pointer to be null
-
bun.zig:341
:cast
-
queue.h:33
:uv__queue_empty
-
req-inl.h:189
:uv__process_reqs
-
core.c:657
:uv_run
-
uws.zig:4290
:tickWithTimeout
-
javascript.zig:3189
:loadEntryPoint
-
bindings.cpp:5068
:JSC__VM__holdAPILock
-
shimmer.zig:201
:cppFn
-
run_command.zig:1373
:exec
-
cli.zig:2078
:start
Features: fetch, jsc, tsconfig, tsconfig
Sentry Issue: BUN-A0J