Skip to content

fix(cli): Report dashboard widget failures through the shared error policy - #1929

Merged
BYK merged 4 commits into
mainfrom
fix/cli-dashboard-widget-error-reporting
Nov 4, 2026
Merged

BYK merged 4 commits into
mainfrom
fix/cli-dashboard-widget-error-reporting

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

sentry dashboard view sent each failed widget query to Sentry with a raw captureException. That call skipped the policy in reportCliError, so:

  • 404s were captured even though 401–499 ApiErrors are meant to be silenced. One user re-viewing one dashboard produced about 13% of a 300-event sample of CLI-10. Every widget sends its own event.
  • 400s had no cli_error.* tags and no api_error context, so they landed in CLI-10 with an empty endpoint and no detail. Another 7% of the sample was this.

Widget failures now go through reportCliError, as its best-effort-catch contract requires. The widget also shows the server's detail, wrapped to the widget width. Before, the status line alone filled the widget and was cut off.

Before

╭─ Screen load p50 ──────────────────────────────╮╭─ Worker errors ────────────────────────────────╮
│ (query failed: API request failed: 400 Bad Req ││ (query failed: API request failed: 404 Not Fou │
│                                                ││                                                │

Sentry received both errors as ApiError: API request failed: 400 Bad Request / 404 Not Found, with no endpoint tag and no detail.

After

╭─ Screen load p50 ──────────────────────────────╮╭─ Worker errors ────────────────────────────────╮
│ (query failed: API request failed: 400 Bad     ││ (query failed: API request failed: 404 Not     │
│ Request: tags[view_ms,number] is invalid for   ││ Found: The requested resource does not exist)  │
│ parameter 1 in p50. Its a string type field,   ││                                                │
│ but it must be one of these types:             ││                                                │
│ {'duration', 'number'})                        ││                                                │

Sentry now gets the 400 with cli_error.api_endpoint and the api_error detail. The 404 is recorded only in the cli.error.silenced metric.

--json output gets the same detail in the widget's message.

Keeping it from coming back

A new sentry-cli/no-raw-capture-exception Oxlint rule flags any captureException in packages/cli/src outside error-reporting.ts. reportCliError now takes optional tags, extra and level, and the 18 existing raw call sites use it. AGENTS.md documents the rule.

Before

import { captureException } from "@sentry/node";
captureException(error); // lint passes

After

× sentry-cli(no-raw-capture-exception): Report errors with reportCliError() from lib/error-reporting.js. A raw captureException skips the 4xx silencing and API error context.
   ╭─[packages/cli/src/lib/tmp-raw-capture.ts:1:10]
 1 │ import { captureException } from "@sentry/node";
   ·          ────────────────

What the migration changes: 401–499 ApiErrors and offline network errors from those best-effort sites now go to the cli.error.silenced metric instead of becoming issues, for example a 403 when auto-adding yourself to a new team. Grouping stays the same. The project's fingerprint rules key only on cli_error.class for CLI error classes, and those tags were already set in beforeSend.

via @BYK.

--

View Session [Sentry]

@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 4, 2026 3:06pm UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 4, 2026

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Well, you already know what I'm going to tell you: make sure this can never happen again. My hunch is a lint rule but feel free to use another method if you see fit.

…olicy

Widget query failures were sent with a raw captureException, skipping the 4xx silencing rules and the cli_error tags. They now go through reportCliError, and the widget shows the API detail, wrapped to the widget width.
Add the sentry-cli/no-raw-capture-exception lint rule so a raw
captureException can't skip the 4xx/network silencing and api_error
context again (CLI-10). reportCliError now takes optional tags, extra,
and level, and the 18 existing raw call sites use it.
…get-error-reporting

# Conflicts:
#	packages/cli/src/lib/dsn/fs-utils.ts
…get-error-reporting

# Conflicts:
#	.oxlintrc.json
#	packages/cli/AGENTS.md
#	packages/cli/lint-rules/cli-oxlint-plugin.js
@BYK
BYK enabled auto-merge (squash) November 4, 2026 20:41
@BYK
BYK merged commit f84df1e into main Nov 4, 2026
40 checks passed
@BYK
BYK deleted the fix/cli-dashboard-widget-error-reporting branch November 4, 2026 20:53
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