Skip to content

fix(error-reporting): silence ContextError to stop crash reports (CLI-3B)#1149

Merged
BYK merged 1 commit into
mainfrom
byk/fix/silence-context-error
Jun 26, 2026
Merged

fix(error-reporting): silence ContextError to stop crash reports (CLI-3B)#1149
BYK merged 1 commit into
mainfrom
byk/fix/silence-context-error

Conversation

@BYK

@BYK BYK commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

ContextError is thrown when the user omits a required value — no
org/project could be auto-detected, a required ID was not provided, etc. It is
an expected user-input error (per AGENTS.md: "User omitted a required value →
ContextError"
), yet it was still reported to Sentry as an unhandled crash.

That made it the single highest-volume issue in the project:

Issue Title Users Events
CLI-3B Could not auto-detect organization and project 1985 9003
CLI-CG Event ID is required 619 1618
CLI-1BC Specific project is required 133 291
CLI-1BD Span ID is required 90 194

Fix

Classify ContextError as silenced in classifySilenced, mirroring the
existing OutputError / expected-AuthError / 401–499 ApiError rules:

  • Volume is preserved via the cli.error.silenced metric, now enriched with the
    ContextError.resource so the missing value (e.g. "Organization and project" vs "Event ID") keeps sub-grouping context. resource values are a
    small fixed set, so metric cardinality stays low.
  • Silenced errors also no longer mark the session as crashed, so missing-input
    errors stop skewing release-health.

Why the whole class (vs. opt-in like ResolutionError)

ContextError always means "you didn't provide X" — there is nothing
per-instance to investigate. This differs from ResolutionError, where a
provided value that can't be matched may signal a product/access issue worth
observing (which is why that class is silenced opt-in). The cli.error.silenced
metric still records the volume and which value was missing.

Test plan

  • classifySilenced tests updated: ContextError now asserts "context_missing"
    (removed from the "does NOT silence" list).
  • reportCliError integration: ContextError now asserts no captureException
    • a cli.error.silenced metric carrying error_class, reason, resource.
  • telemetry test updated: ContextError is silenced and does not mark the
    session crashed.
  • vitest run test/lib/error-reporting.test.ts test/lib/telemetry.test.ts → 183 passed
  • property + session telemetry suites → 65 passed
  • biome check clean on changed files

Fixes CLI-3B

)

ContextError is thrown when the user omits a required value — no
org/project could be auto-detected, a required ID was not provided, etc.
It is an expected user-input error, never a CLI bug, yet it was still
reported to Sentry as an unhandled crash. This made it the single
highest-volume issue (CLI-3B: ~2000 users / ~9000 events, plus CLI-CG,
CLI-1BC, CLI-1BD).

Classify ContextError as silenced in classifySilenced, mirroring the
existing OutputError / expected-AuthError / 4xx-ApiError rules. Volume is
preserved via the cli.error.silenced metric, now enriched with the
ContextError resource so the missing value (e.g. "Organization and
project" vs "Event ID") keeps sub-grouping context.

Unlike ResolutionError — where a provided-but-unmatched value can signal
a product/access issue worth observing — ContextError has nothing
per-instance to investigate, so the whole class is silenced. Silenced
errors also no longer mark the session as crashed, which keeps
release-health from being skewed by missing-input errors.
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Jun 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-1149/

Built to branch gh-pages at 2026-06-26 20:01 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 5133 uncovered lines.
❌ Project coverage is 81.46%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    81.53%    81.46%    -0.07%
==========================================
  Files          397       397         —
  Lines        27682     27686        +4
  Branches     17968     17972        +4
==========================================
+ Hits         22570     22553       -17
- Misses        5112      5133       +21
- Partials      1867      1861        -6

Generated by Codecov Action

@BYK BYK merged commit 795e3b8 into main Jun 26, 2026
28 checks passed
@BYK BYK deleted the byk/fix/silence-context-error branch June 26, 2026 20:12
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.

1 participant