From a1fbca08756c3d4c264f0d1a2b32f224b046c38d Mon Sep 17 00:00:00 2001 From: jhapate0704 Date: Tue, 6 Oct 2026 16:33:05 +0530 Subject: [PATCH 1/2] fix(cli): improve missing binary error message for Windows ARM64 --- .changeset/fix-windows-arm64-error.md | 5 +++++ packages/opencode/bin/kilo | 22 +++++++++++++++++----- packages/opencode/script/postinstall.mjs | 4 +++- 3 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 .changeset/fix-windows-arm64-error.md diff --git a/.changeset/fix-windows-arm64-error.md b/.changeset/fix-windows-arm64-error.md new file mode 100644 index 00000000000..e972d657a6a --- /dev/null +++ b/.changeset/fix-windows-arm64-error.md @@ -0,0 +1,5 @@ +--- +"@kilocode/cli": patch +--- + +Improve missing binary error message on Windows ARM64 to provide actionable workarounds (x64 emulation or WSL2). diff --git a/packages/opencode/bin/kilo b/packages/opencode/bin/kilo index f5a18633b86..6c988c91ed7 100755 --- a/packages/opencode/bin/kilo +++ b/packages/opencode/bin/kilo @@ -207,14 +207,26 @@ function findBinary(startDir) { } } +// kilocode_change start const resolved = envPath || (fs.existsSync(cached) ? cached : findBinary(scriptDir)) if (!resolved) { - console.error( - "It seems that your package manager failed to install the right version of the Kilo CLI for your platform. You can try manually installing " + - names.map((n) => `\"${n}\"`).join(" or ") + - " package", - ) + if (platform === "windows" && arch === "arm64") { + console.error( + "The Kilo CLI native binary for Windows ARM64 could not be found.\n" + + "If the native package is unavailable, you can try manually installing the x64 version to run under Windows 11 emulation:\n" + + " npm install -g @kilocode/cli-windows-x64\n" + + "Alternatively, use WSL2 with the Linux ARM64 build." + ) + } else { + console.error( + "It seems that your package manager failed to install the right version of the Kilo CLI for your platform.\n" + + "You can try manually installing the " + + names.map((n) => `"${n}"`).join(" or ") + + " package, or download a pre-built binary from the GitHub Releases page." + ) + } process.exit(1) } +// kilocode_change end run(resolved, resolved === cached ? () => findBinary(scriptDir) : undefined) // kilocode_change - preserve cached binary fallback diff --git a/packages/opencode/script/postinstall.mjs b/packages/opencode/script/postinstall.mjs index 2b811968ce1..32bd59a850b 100644 --- a/packages/opencode/script/postinstall.mjs +++ b/packages/opencode/script/postinstall.mjs @@ -207,11 +207,13 @@ function main() { } } + // kilocode_change start throw new Error( `It seems your package manager failed to install the right Kilo CLI package. Try manually installing ${packageNames() .map((name) => JSON.stringify(name)) - .join(" or ")}.`, + .join(" or ")}. Or download the pre-built binary from the GitHub Releases page.`, ) +// kilocode_change end } try { From 31fed7f43de1b5024f1b864d85af2d65d0d26792 Mon Sep 17 00:00:00 2001 From: jhapate0704 Date: Tue, 6 Oct 2026 17:20:30 +0530 Subject: [PATCH 2/2] fix(cli): address bot review comments --- packages/opencode/bin/kilo | 3 +- .../test/kilocode/bin-startup.test.ts | 28 ++++++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/packages/opencode/bin/kilo b/packages/opencode/bin/kilo index 6c988c91ed7..56828f2ecd3 100755 --- a/packages/opencode/bin/kilo +++ b/packages/opencode/bin/kilo @@ -213,8 +213,7 @@ if (!resolved) { if (platform === "windows" && arch === "arm64") { console.error( "The Kilo CLI native binary for Windows ARM64 could not be found.\n" + - "If the native package is unavailable, you can try manually installing the x64 version to run under Windows 11 emulation:\n" + - " npm install -g @kilocode/cli-windows-x64\n" + + "If the native package is unavailable, you can try downloading the pre-built x64 binary from the GitHub Releases page to run under Windows 11 emulation.\n" + "Alternatively, use WSL2 with the Linux ARM64 build." ) } else { diff --git a/packages/opencode/test/kilocode/bin-startup.test.ts b/packages/opencode/test/kilocode/bin-startup.test.ts index d4a170b8428..560dda99455 100644 --- a/packages/opencode/test/kilocode/bin-startup.test.ts +++ b/packages/opencode/test/kilocode/bin-startup.test.ts @@ -67,7 +67,9 @@ const trace = { probes: [], spawns: [], signals: [] } const signals = ["SIGINT", "SIGTERM", "SIGHUP"] const listeners = () => signals.map((signal) => process.listenerCount(signal)) os.platform = () => "win32" -os.arch = () => "x64" +// kilocode_change start +os.arch = () => input.arch ?? "x64" +// kilocode_change end os.hostname = () => input.host ?? "test-host" os.release = () => "10.0.26100" os.cpus = () => [{ model: "test CPU" }] @@ -242,4 +244,28 @@ describe("npm launcher startup", () => { expect(await Bun.file(join(root, "kilo", "bin", "windows-avx2.json")).exists()).toBe(true) expect((await item.run({ cache })).probes).toEqual([]) }) + +// kilocode_change start + test("prints helpful emulation message for missing binary on Windows ARM64", async () => { + await using item = await fixture() + await rm(item.optimized) + await rm(item.baseline) + const pkg = join(item.root, "node_modules", "@kilocode", "cli") + const wrapper = join(pkg, "bin", "kilo") + const preload = join(item.root, "preload.cjs") + + // Run the script directly to capture stderr, since findBinary will fail and call process.exit(1) + const proc = Bun.spawnSync([node, "--require", preload, wrapper], { + cwd: item.root, + env: { + KILO_STARTUP_TEST: JSON.stringify({ arch: "arm64" }), + KILO_STARTUP_LOG: item.root + "/trace.json", + }, + }) + const stderr = proc.stderr.toString() + expect(proc.exitCode).toBe(1) + expect(stderr).toContain("The Kilo CLI native binary for Windows ARM64 could not be found.") + expect(stderr).toContain("GitHub Releases page to run under Windows 11 emulation") + }) +// kilocode_change end })