fix: enrich event 404 errors with retention and format suggestions (CLI-6F)#491
fix: enrich event 404 errors with retention and format suggestions (CLI-6F)#491
Conversation
…LI-6F) When `sentry event view` gets a 404 Not Found, the generic 'Failed to get event: 404 Not Found' doesn't help users diagnose the cause. This affects 54 users (CLI-6F). Extracted event fetching into a fetchEventWithContext() helper that catches 404 errors and throws a ResolutionError with suggestions: - Data retention policies may have deleted the event - Verify the event ID is a 32-char hex string - Check if the event belongs to a different project This also fixes the biome complexity lint by extracting the try-catch into a separate function instead of adding it inline to func().
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Codecov Results 📊✅ 126 passed | Total: 126 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 1037 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 95.78% 95.78% —%
==========================================
Files 180 180 —
Lines 24566 24579 +13
Branches 0 0 —
==========================================
+ Hits 23529 23542 +13
- Misses 1037 1037 —
- Partials 0 0 —Generated by Codecov Action |
1. Use actual eventId variable in hint and suggestions instead of placeholder 2. Use already-imported SentryEvent type instead of inline import()
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| throw new ResolutionError( | ||
| `Event '${eventId}'`, | ||
| `not found in ${org}/${project}`, | ||
| `sentry event view ${org}/${project} ${eventId}`, |
There was a problem hiding this comment.
"Try" hint repeats the exact failing command
Low Severity
The hint parameter passed to ResolutionError is sentry event view ${org}/${project} ${eventId}, which is the exact command the user just ran that produced the 404. The buildResolutionMessage function renders this under a Try: heading, so the error message suggests retrying the identical failing command. Compare with the analogous ResolutionError in resolveOrgAllTarget, which uses a <project> placeholder to provide genuinely actionable guidance. The hint here could use a placeholder or point to a different resolution path instead.
…ing command Address unresolved Bugbot review from PR #491: the 'Try:' hint in fetchEventWithContext repeated the exact command that just failed. Changed to use a <project> placeholder so it suggests trying a different project, and updated the suggestion bullet to explicitly say 'Search across all projects in the org'.
…ing command (#492) ## Follow-up to PR #491 Addresses unresolved [Bugbot review comment](#491 (comment)) that I missed before merging #491. ## Problem The `Try:` hint in `fetchEventWithContext` repeated the exact command that just produced the 404: ``` Event 'abc123' not found in my-org/my-project. Try: sentry event view my-org/my-project abc123 ← same failing command! ``` ## Fix Changed the hint to use a `<project>` placeholder to suggest trying a different project, and updated the `Or:` suggestion to explicitly mention org-wide search: ``` Event 'abc123' not found in my-org/my-project. Try: sentry event view my-org/<project> abc123 ← try a different project Or: - The event may have been deleted due to data retention policies - Verify the event ID is a 32-character hex string (e.g., a1b2c3d4...) - Search across all projects in the org: sentry event view my-org/ abc123 ```


Problem
When
sentry event viewgets a 404 Not Found, the error shows:This doesn't help users diagnose whether the event ID is wrong, the event was deleted due to data retention, or it belongs to a different project. Affects 54 users (CLI-6F).
Fix
Extracted event fetching into a
fetchEventWithContext()helper that catches 404 errors and throws aResolutionErrorwith actionable suggestions:Design Decisions
func()ResolutionErrorpattern consistent with other commandssentry event view my-org/ <event-id>) hints at org-wide search