Skip to content

fix(event): auto-fallback to org-wide search when event 404s in project#575

Merged
BYK merged 2 commits intomainfrom
fix/event-view-cross-project-fallback
Mar 26, 2026
Merged

fix(event): auto-fallback to org-wide search when event 404s in project#575
BYK merged 2 commits intomainfrom
fix/event-view-cross-project-fallback

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Mar 26, 2026

Summary

When sentry event view my-org/my-project <event-id> returns a 404, it typically means the event exists in a different project within the same org (e.g., DSN auto-detection picked the wrong project).

Previously, the user got a ResolutionError with a suggestion to try sentry event view my-org/ <event-id> (org-wide search). This required a second manual invocation.

Fix

Now fetchEventWithContext() automatically tries resolveEventInOrg() when the project-scoped fetch returns 404. If the event is found in another project, it's returned with a warning:

⚠ Event not found in my-org/my-project, but found in my-org/other-project.

If the org-wide search also fails, the original ResolutionError with suggestions is shown (unchanged behavior).

Sentry Issue

Fixes CLI-KW (9 users, 12 events in 0.20.0)

Changes

  • src/commands/event/view.ts: Added cross-project fallback in fetchEventWithContext(), exported function for testing
  • test/commands/event/view.test.ts: Added 5 tests covering the fallback scenarios

When `event view` gets a 404 from the project-scoped endpoint, it now
automatically tries `resolveEventInOrg()` to search across all projects
in the org before throwing a ResolutionError.

This handles the common case where DSN auto-detection or config defaults
resolve to the wrong project within the correct org. The user sees a
warning about the redirect:

  Event not found in my-org/my-project, but found in my-org/other-project.

If the org-wide search also fails, the original ResolutionError with
suggestions is shown (unchanged behavior).

Fixes CLI-KW (9 users, 12 events in 0.20.0)
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 26, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Dashboard

  • Add pagination and glob filtering to dashboard list by BYK in #560
  • Rich terminal chart rendering for dashboard view by BYK in #555

Init

  • Propagate sentry-trace headers to wizard API calls by betegon in #567
  • Treat bare slug as new project name when not found by BYK in #554

Other

  • (formatters) Colorize SQL in DB span descriptions by BYK in #546
  • (telemetry) Report unknown commands to Sentry by BYK in #563
  • Bidirectional cursor pagination (-c next / -c prev) by BYK in #564
  • Add sentry sourcemap inject and sentry sourcemap upload commands by BYK in #547
  • Native debug ID injection and sourcemap upload by BYK in #543

Bug Fixes 🐛

Dashboard

  • Default issue dataset table columns to ["issue"] by betegon in #570
  • Scale timeseries bar width to fill chart area by BYK in #562
  • Resolve dashboard by ID/slug in addition to title by BYK in #559

Other

  • (event) Auto-fallback to org-wide search when event 404s in project by BYK in #575
  • (event-view) Auto-redirect issue short IDs in two-arg form (CLI-MP) by BYK in #558
  • (help) Show help when user passes help as positional arg by BYK in #561
  • Reject @-selectors in parseOrgProjectArg with helpful redirect by BYK in #557

Internal Changes 🔧

Coverage

  • Use informational-patch input instead of sed hack by BYK in #544
  • Make checks informational on release branches by BYK in #541

Other

  • (api) Collapse stats on issue detail endpoints to save 100-300ms by BYK in #551
  • (ci) Upgrade GitHub Actions to Node 24 runtime by BYK in #542
  • (db) DRY up database layer with shared helpers and lint enforcement by BYK in #550
  • (issue-list) Use collapse parameter to skip unused Snuba queries by BYK in #545
  • Bump Bun from 1.3.9 to 1.3.11 by BYK in #552
  • Regenerate skill files by github-actions[bot] in ec1ffe28

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 26, 2026

Codecov Results 📊

126 passed | Total: 126 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 1276 uncovered lines.
✅ Project coverage is 95.43%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    95.43%    95.43%        —%
==========================================
  Files          194       194         —
  Lines        27894     27921       +27
  Branches         0         0         —
==========================================
+ Hits         26620     26645       +25
- Misses        1274      1276        +2
- Partials         0         0         —

Generated by Codecov Action

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Address Cursor Bugbot feedback:
1. Wrap resolveEventInOrg in try-catch so non-404 errors (500, network)
   don't mask the helpful ResolutionError with suggestions
2. Replace redundant 'search across all projects' suggestion with
   'event was not found in any project' since we already tried the
   org-wide search
@BYK
Copy link
Copy Markdown
Member Author

BYK commented Mar 26, 2026

Addressed both Cursor Bugbot findings in a20a6c3:

  1. Fallback error masking: Wrapped resolveEventInOrg in try-catch so non-404 errors (500s, network failures) don't propagate and mask the helpful ResolutionError with suggestions.

  2. Redundant suggestion: Replaced "Search across all projects in the org: sentry event view org/ eventId" with "The event was not found in any project in 'org'" since we already performed that org-wide search automatically.

@BYK BYK merged commit 3c9950f into main Mar 26, 2026
22 checks passed
@BYK BYK deleted the fix/event-view-cross-project-fallback branch March 26, 2026 16:48
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