Repository navigation
Show the server's host package error in the machine installer - #4212
Merged
Merged
Conversation
When /install/bb-app.tgz failed to build or read the host package, the route fell through to the global error handler and the installer only printed "HTTP 500". The route now logs the failure and returns the underlying error message, and the installer prints it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The install routes are public, including on a Connect server's main handle, so raw exception text could expose server paths. Map the error to a generic reason and return a diagnostic ID that matches the server log entry instead. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
ymichael
deleted the
bb/diagnose-error-from-user-logs-thr_3s8umdj4uf
branch
September 23, 2026 22:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
When
GET /install/bb-app.tgzcouldn't build or read the host package, the exception fell through to the global error handler. That handler returns{"code":"internal_error","message":"Internal server error"}, and the installer ignored the body, so users only sawCould not download the server's bb-app package … (HTTP 500). Nothing tied that failure to an entry in the server log. #3773 (spawn npm ENOENT) and #3118 (missingREADME.md) both reached users as this bare 500.What changed
apps/server/src/server.ts: the route catches failures and logs the full error as "Host package download failed" with a newdiagnosticId. It returns500with{ code: "host_package_unavailable", message, diagnosticId }andcache-control: no-store. The message is a generic reason picked from the error code (missing file, permissions, disk full, or other), plus the diagnostic ID.apps/connect/src/worker.ts,isPublicInstallPath), and raw messages can contain absolute server paths (and so the OS username). Showing detailed errors only to callers that present an enroll key or daemon host key is a possible follow-up.apps/server/src/assets/install-machine.sh: on any 4xx/5xx the installer reads the body as JSON and printsServer: <message>before its existing fallback or failure step. It skips bodies over 16 KB, replaces control characters and caps the message at 2000 characters. Non-JSON bodies such as proxy HTML pages print nothing extra.docs/configuration.md: documents the behaviour.This isn't a daemon wire change. The route and the installer ship together from the same server.
Example installer output:
How you verified
skeleton.test.ts: for each error-code group, the route returns 500 withno-store, the expected generic reason and a diagnostic ID, and doesn't include the raw error text. The loggeddiagnosticIdmatches the one in the response.install-machine-script.test.ts: when the fixture returns a 500, the installer printsServer: …for a JSON body, prints nothing extra for HTML or invalid JSON, and never runsnpm install.pnpm exec turbo run typecheck lint test --filter=@bb/serverpasses.pnpm start:worktreeserver with<dataDir>/install-cachereplaced by a plain file and confirmed that/install/bb-app.tgzreturned 500 with the new JSON body and that the error was logged as "Host package download failed".🤖 Generated with Claude Code