Skip to content

fix: map EBADPLATFORM and Git SSH auth failures to UnsupportedPackageError (422) - #104

Merged
pastelsky merged 1 commit into
masterfrom
fix/classify-unsupported-platform-errors
Aug 10, 2026
Merged

fix: map EBADPLATFORM and Git SSH auth failures to UnsupportedPackageError (422)#104
pastelsky merged 1 commit into
masterfrom
fix/classify-unsupported-platform-errors

Conversation

@pastelsky

Copy link
Copy Markdown
Owner

Problem

Packages with target platform/CPU constraints (e.g. @esbuild/android-arm specifying "os": ["android"], "cpu": ["arm"]) or private Git SSH repositories (ls-remote ssh://git@github.com/...) failed during installation with code EBADPLATFORM or Permission denied (publickey).

Previously, InstallationUtils caught these process failures and threw InstallError (surfaced as an HTTP 500 server crash).

Solution

  1. Add isUnsupportedPackage helper in src/utils/installation.utils.ts to match:
    • code EBADPLATFORM
    • Unsupported platform
    • ERR_PNPM_UNSUPPORTED_PLATFORM
    • unsupported architecture
    • Git SSH authentication failures (Permission denied (publickey) / fatal: Could not read from remote repository)
  2. Throw UnsupportedPackageError (which maps cleanly to HTTP 422 Unprocessable Entity) instead of InstallError (HTTP 500).
  3. Add 4 unit tests in tests/fast/installation.utils.test.ts and an integration test in tests/slow/error-handling.test.ts verifying @esbuild/android-arm@0.28.1 throws UnsupportedPackageError.

Verification

  • Fast Unit Tests: 64 / 64 Passed (corepack yarn test)
  • Slow Integration Tests: 14 / 14 Passed (corepack yarn vitest run tests/slow/error-handling.test.ts)
  • Formatting & Type Check: 0 Warnings, 0 Errors (corepack yarn check)

…Error

Platform architecture mismatches (e.g. @esbuild/android-arm wanted os: android, cpu: arm)
and unresolvable private Git SSH repositories (Permission denied publickey) previously
threw an unhandled InstallError (surfaced as HTTP 500).

1. Add isUnsupportedPackage helper in installation.utils.ts to match EBADPLATFORM,
   Unsupported platform, ERR_PNPM_UNSUPPORTED_PLATFORM, unsupported architecture, and
   Git SSH permission denied output.
2. Throw UnsupportedPackageError (mapped to HTTP 422) instead of InstallError (HTTP 500).
3. Add unsupported-platform test fixture and mock unit tests + slow integration test.
@pastelsky
pastelsky force-pushed the fix/classify-unsupported-platform-errors branch from 325eeb3 to da102c7 Compare August 10, 2026 16:07
@pastelsky
pastelsky merged commit 3407bd8 into master Aug 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant