Repository navigation
Description
Summary
Creating a thread with a Modal sandbox from bb Desktop 0.43.1 fails during bb machine setup because the server's /install/bb-app.tgz endpoint returns HTTP 500. The server log records spawn npm ENOENT while generating the host artifact. I expected the sandbox to download the matching bb daemon package and complete provisioning.
Versions and environment
- bb Desktop 0.43.1, installed at
/Applications/bb.app - macOS 15.2 (24C101), arm64
- Bundled
environment-modal-sandboxplugin 0.1.0 - Default server port
38886and data directory~/.bb - bb Connect enabled; the local and public routes reproduce identically
- BB launched normally as a macOS desktop application
- Server process PATH:
/usr/bin:/bin:/usr/sbin:/sbin - Homebrew npm:
/opt/homebrew/bin/npm - Tested release tag:
desktop-v0.43.1, commit267938526dfcbc0edb228ce827b5bec202c1af97
Steps to reproduce
The artifact endpoint is the smallest reproduction and does not require allocating Modal compute.
-
Launch bb Desktop normally on macOS.
-
Confirm the installed server version:
curl -sS http://127.0.0.1:38886/install/version
-
Request the host artifact:
curl -sS \ --output /tmp/bb-app.tgz \ --write-out '%{http_code}\n' \ http://127.0.0.1:38886/install/bb-app.tgz -
Inspect the new entries in
~/.bb/logs/server-stdio.log.
To observe the product impact:
- Configure the bundled Modal sandbox plugin with valid credentials.
- Create a thread using the Modal sandbox environment.
- Provisioning reaches
bb machine setupand fails while downloading/install/bb-app.tgz.
Expected vs actual
Expected:
/install/bb-app.tgz returns HTTP 200 with the server-matched bb host artifact.
The Modal machine installs the artifact, connects to BB, and thread provisioning continues.
Actual version and account checks:
$ bb --version
0.43.1
$ curl -sS http://127.0.0.1:38886/install/version
{"version":"0.43.1","protocolVersion":207}
$ bb modal account inspect --json
{"available":true,"message":"Connected to Modal (bb-sandboxes)"}
Actual artifact response:
$ curl -sS \
--output /tmp/bb-app.tgz \
--write-out '%{http_code}\n' \
http://127.0.0.1:38886/install/bb-app.tgz
500
$ cat /tmp/bb-app.tgz
{"code":"internal_error","message":"Internal server error"}
The same request through the account's public *.getbb.app route also returns HTTP 500.
Modal provisioning reports:
Machine bootstrap command failed:
bb machine setup
✗ Could not download the server's bb-app package from
https://<account>.getbb.app/install/bb-app.tgz (HTTP 500).
Evidence
Two requests made at 2026-09-16 12:43:34 UTC—one against localhost and one through bb Connect—produced matching server errors:
[07:43:34] ERROR: [server] Unhandled server error
err: {
"type": "Error",
"message": "spawn npm ENOENT",
"stack":
Error: spawn npm ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:287:19)
at onErrorNT (node:internal/child_process:508:16)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
"errno": -2,
"code": "ENOENT",
"syscall": "spawn npm",
"path": "npm",
"spawnargs": [
"pack",
"--pack-destination",
"/Users/<user>/.bb/install-cache"
],
"cmd": "npm pack --pack-destination /Users/<user>/.bb/install-cache",
"stdout": "",
"stderr": ""
}
The running server is the installed desktop binary:
/Applications/bb.app/Contents/MacOS/bb
/Applications/bb.app/Contents/Resources/app.asar.unpacked/node_modules/bb-app/server/dist/index.js
Its environment contains:
PATH=/usr/bin:/bin:/usr/sbin:/sbin
The application ships a functional npm 11.16.0. Invoking it directly works even with an empty PATH:
PATH='' ELECTRON_RUN_AS_NODE=1 \
/Applications/bb.app/Contents/MacOS/bb \
/Applications/bb.app/Contents/Resources/app.asar.unpacked/node_modules/npm/bin/npm-cli.js \
--version11.16.0
Cause hypothesis
This is separate from the observed reproduction, but the release code strongly supports it.
The artifact builder passes bare "npm" to its command runner:
bb/apps/server/src/services/install/bb-app-artifact.ts
Lines 269 to 274 in 2679385
| try { | |
| const stdout = await commandRunner( | |
| "npm", | |
| ["pack", "--pack-destination", cacheDir], | |
| hostPackageRoot, | |
| ); |
The default runner passes that command directly to execFile, requiring npm to be on the desktop server's PATH:
bb/apps/server/src/services/install/bb-app-artifact.ts
Lines 66 to 75 in 2679385
| async function defaultCommandRunner( | |
| command: string, | |
| args: readonly string[], | |
| cwd: string, | |
| ): Promise<string> { | |
| const result = await execFileAsync(command, [...args], { | |
| cwd, | |
| maxBuffer: 10 * 1024 * 1024, | |
| }); | |
| return result.stdout; |
The desktop application already ships a working npm, but this artifact-generation path does not resolve or invoke it.
Investigation thread: https://whiny.getbb.app/threads/thr_t5qimadvke
What you ruled out
- Not invalid Modal credentials:
bb modal account inspect --jsonsucceeds. - Not Modal image construction: the failure occurs while downloading BB's daemon artifact during bootstrap.
- Not bb Connect or external reachability: localhost and the public
*.getbb.approute fail identically. - Not a transient HTTP failure: the endpoint reproduces consistently and logs a matching exception for every request.
- Not macOS desktop 0.42.0: missing README.md makes daemon auto-update return HTTP 500 #3118: that issue involved a missing
README.md; this release logsspawn npm ENOENT. - Not Bundled npm in the macOS app is shipped without its own node_modules, so every plugin install fails with Cannot find module 'proc-log' #3566: that issue involved missing dependencies inside bundled npm; the bundled npm in 0.43.1 executes successfully when addressed directly.
- Not a source checkout: reproduction uses the unmodified official Desktop 0.43.1 application.
- Searched open and closed issues and pull requests for
spawn npm ENOENT,bb-app.tgz, Modal sandbox provisioning, npm PATH, and machine setup. No issue with this root cause was found.
Suggested priority and effort
High — blocks Modal sandbox provisioning and potentially other fresh machine enrollment from affected macOS desktop installations launched with the normal GUI PATH. There is no supported user-facing workaround and the failure is surfaced only as HTTP 500. Effort is likely Low because the application already bundles a functioning npm and has existing code paths that resolve it explicitly.
AGENT GENERATED
Activity
bb-slop-cop commentedon Sep 16, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotApplied Bug · High priority · Low effort; labels:
desktop,confirmed-repro. No existing classifications were replaced.Reproduction and root-cause report — REPRODUCED at the artifact-service level, high root-cause confidence.
At trusted
maincommit6084f894305e389604ce19b1cace442b0fc25bad, the default artifact runner launches barenpm, so a restricted PATH producesENOENTdespite the bundled CLI being available. The repeatable test failed identically in two clean checkouts; invoking bundled npm by absolute path packed the same fixture successfully. Both repository builds passed. Installed Electron, HTTP, Connect, and full Modal provisioning were not exercised.No PR: the required correction affects host-artifact packaging, which this rule excludes from automatic fixes.
Use the bundled npm and npx for server-side package-manager calls (ge…
Show the server's host package error in the machine installer (#4212)