oven-sh/bun · error · Error

Program could not be started.

Error message

Program could not be started.

What it means

Thrown during a DAP launch/attach request when #spawn of the debugee (the runtime binary with BUN_INSPECT configured) reports it could not start. It indicates the runtime executable failed to spawn — bad path, missing binary, or spawn error — not a failure of the program itself.

Solutions

  1. Verify the runtime (default: bun) is on PATH and the program path exists
  2. Check that the inspector port is free and retry the launch
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at packages/bun-debug-adapter-protocol/src/debugger/adapter.ts:2236 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/aaef607ab586d1a4. Report an issue: GitHub.

Appendix: source

Thrown at packages/bun-debug-adapter-protocol/src/debugger/adapter.ts:2236

      const query = stopOnEntry ? "break=1" : "wait=1";
      processEnv["BUN_INSPECT"] = `${url}?${query}`;
      processEnv["BUN_INSPECT_NOTIFY"] = signal.url;

      // This is probably not correct, but it's the best we can do for now.
      processEnv["FORCE_COLOR"] = "1";
      processEnv["BUN_QUIET_DEBUG_LOGS"] = "1";
      processEnv["BUN_DEBUG_QUIET_LOGS"] = "1";

      const started = await this.#spawn({
        command: runtime,
        args: processArgs,
        env: processEnv,
        cwd,
        isDebugee: true,
      });

      if (!started) {
        throw new Error("Program could not be started.");
      }
    } else {
      // we're on windows
      // Create TCPSocketSignal
      const url = `ws://127.0.0.1:${await getAvailablePort()}/${getRandomId()}`; // 127.0.0.1 so it resolves correctly on windows
      const signal = new TCPSocketSignal(await getAvailablePort());

      signal.on("Signal.received", async () => {
        this.#attach({ url });
      });

      this.once("Adapter.terminated", () => {
        signal.close();
      });

      const query = stopOnEntry ? "break=1" : "wait=1";
      processEnv["BUN_INSPECT"] = `${url}?${query}`;
      processEnv["BUN_INSPECT_NOTIFY"] = signal.url; // 127.0.0.1 so it resolves correctly on windows

View on GitHub (pinned to 8c5296ac45)