Skip to content

fix(cli): use process.versions.bun to detect missing getSystemErrorMap - #1465

Closed
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-bun-get-system-error-map
Closed

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-bun-get-system-error-map

Conversation

@sentry

@sentry sentry Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

In bun-compiled binaries, _require("node:util") resolved to the bundled Node.js util module (from the build environment), which has getSystemErrorMap. This caused hasGetSystemErrorMap to evaluate to true even when running on bun 1.3.9 where node:util actually lacks getSystemErrorMap, resulting in a crash inside NodeSystemError's processEvent hook (TypeError: _o.getSystemErrorMap is not a function).

Replaced the _require-based detection with !process.versions.bun, which accurately reflects the runtime environment regardless of bundler behavior.

Fixes CLI-3HF

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Oct 11, 2026

@sentry-junior sentry-junior Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing this one: the failure it targets comes from an old release that didn't have the guard this PR rewrites.

  • The event predates the guard. The linked issue has a single event, from CLI 0.19.0 on Bun 1.3.9. 0.19.0 was released on 2026-03-20. The hasGetSystemErrorMap check and the NodeSystemError filter were added in getsentry/cli#523 (CLI-K1), which first shipped in 0.20.0 on 2026-03-23. src/lib/telemetry.ts at the 0.19.0 tag has no getSystemErrorMap or NodeSystemError handling at all. So this crash is the original CLI-K1 bug in an old binary, not the current check giving a wrong answer.
  • Nothing supports the "bundled node:util" explanation. No event from a release that has the guard shows this error. Current releases are built as Node SEA binaries (see packages/cli/AGENTS.md), not with bun build --compile.
  • The replacement is less accurate. !process.versions.bun turns off NodeSystemError on every Bun runtime, even one that implements util.getSystemErrorMap. The current check tests for the API the integration actually calls.

If a release with the guard (>= 0.20.0) ever shows getSystemErrorMap is not a function, that event would be the evidence to reopen this.

@sentry-junior sentry-junior Bot closed this Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants