sentry-fix-issues

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Fix Sentry Issues

修复Sentry问题

Discover, analyze, and fix production issues using Sentry's full debugging capabilities.
利用Sentry的完整调试能力发现、分析并修复生产环境问题。

Invoke This Skill When

何时调用此技能

  • User asks to "fix Sentry issues" or "resolve Sentry errors"
  • User wants to "debug production bugs" or "investigate exceptions"
  • User mentions issue IDs, error messages, or asks about recent failures
  • User wants to triage or work through their Sentry backlog
  • 用户要求“修复Sentry问题”或“解决Sentry错误”
  • 用户希望“调试生产环境Bug”或“排查异常”
  • 用户提及问题ID、错误消息,或询问近期故障情况
  • 用户希望分类处理或清理Sentry中的待处理问题积压

Prerequisites

前置条件

  • Sentry MCP server configured and connected
  • Access to the Sentry project/organization
  • 已配置并连接Sentry MCP服务器
  • 拥有Sentry项目/组织的访问权限

Phase 1: Issue Discovery

阶段1:问题发现

Use Sentry MCP to find issues. Confirm with user which issue(s) to fix before proceeding.
Search TypeMCP Call
Recent unresolved
sentry_search_issues
query:
"is:unresolved"
sort:
"date"
Specific error type
sentry_search_issues
query:
"is:unresolved error.type:TypeError"
By ID
sentry_get_issue
issue_id:
"PROJECT-123"
使用Sentry MCP查找问题。在开始处理前,与用户确认需要修复的具体问题。
搜索类型MCP调用
近期未解决问题
sentry_search_issues
查询:
"is:unresolved"
排序:
"date"
特定错误类型
sentry_search_issues
查询:
"is:unresolved error.type:TypeError"
按ID查询
sentry_get_issue
issue_id:
"PROJECT-123"

Phase 2: Deep Issue Analysis

阶段2:问题深度分析

Gather ALL available context for each issue:
Data SourceMCP CallExtract
Core Error
sentry_get_issue
Exception type/message, full stack trace, file paths, line numbers, function names
Event Details
sentry_get_event
Breadcrumbs, tags, custom context, request data
Trace (if available)
sentry_get_trace
Parent transaction, spans, DB queries, API calls, error location
Replay (if available)
sentry_get_replay
User actions, UI state, network requests
收集每个问题的所有可用上下文信息:
数据源MCP调用提取内容
核心错误
sentry_get_issue
异常类型/消息、完整堆栈跟踪、文件路径、行号、函数名称
事件详情
sentry_get_event
Breadcrumbs、标签、自定义上下文、请求数据
链路追踪(若可用)
sentry_get_trace
父事务、Span、数据库查询、API调用、错误位置
会话重放(若可用)
sentry_get_replay
用户操作、UI状态、网络请求

Phase 3: Root Cause Hypothesis

阶段3:根本原因假设

Before touching code, document:
  1. Error Summary: One sentence describing what went wrong
  2. Immediate Cause: The direct code path that threw
  3. Root Cause Hypothesis: Why the code reached this state
  4. Supporting Evidence: Breadcrumbs, traces, or context supporting this
  5. Alternative Hypotheses: What else could explain this? Why is yours more likely?
Challenge yourself: Is this a symptom of a deeper issue? Check for similar errors elsewhere, related issues, or upstream failures in traces.
在修改代码前,记录以下内容:
  1. 错误摘要:用一句话描述问题现象
  2. 直接原因:抛出错误的直接代码路径
  3. 根本原因假设:代码为何会进入该状态
  4. 支持证据:能支撑该假设的Breadcrumbs、链路追踪或上下文信息
  5. 备选假设:还有哪些可能的原因?为何你的假设更合理?
自我验证:这是否是更深层次问题的表象?检查是否存在其他类似错误、相关问题,或链路追踪中的上游故障。

Phase 4: Code Investigation

阶段4:代码排查

StepActions
Locate CodeRead every file in stack trace from top down
Trace Data FlowFind value origins, transformations, assumptions, validations
Error BoundariesCheck for try/catch - why didn't it handle this case?
Related CodeFind similar patterns, check tests, review recent commits (
git log
,
git blame
)
步骤操作内容
定位代码自上而下阅读堆栈跟踪中的所有文件
追踪数据流查找值的来源、转换过程、预设条件及验证逻辑
错误边界检查try/catch语句 - 为何未处理该场景?
相关代码查找类似代码模式,检查测试用例,查看最近的提交记录(
git log
git blame

Phase 5: Implement Fix

阶段5:实施修复

Before writing code, confirm your fix will:
  • Handle the specific case that caused the error
  • Not break existing functionality
  • Handle edge cases (null, undefined, empty, malformed)
  • Provide meaningful error messages
  • Be consistent with codebase patterns
Apply the fix: Prefer input validation > try/catch, graceful degradation > hard failures, specific > generic handling, root cause > symptom fixes.
Add tests reproducing exact Sentry event conditions and verifying edge cases.
在编写代码前,确认你的修复方案能够:
  • 处理引发错误的特定场景
  • 不会破坏现有功能
  • 处理边缘场景(null、undefined、空值、格式错误)
  • 提供有意义的错误消息
  • 与代码库的编码模式保持一致
实施修复: 优先选择输入验证而非try/catch,优雅降级而非硬崩溃,特定处理而非通用处理,修复根本原因而非仅处理表象。
添加测试用例,复现Sentry事件的精确条件并验证边缘场景。

Phase 6: Verification Audit

阶段6:验证审核

Complete before declaring fixed:
CheckQuestions
EvidenceDoes fix address exact error message? Handle data state shown? Prevent ALL events?
RegressionCould fix break existing functionality? Other code paths affected? Backward compatible?
CompletenessSimilar patterns elsewhere? Related Sentry issues? Add monitoring/logging?
Self-ChallengeRoot cause or symptom? Considered all event data? Will handle if occurs again?
在宣布问题修复前完成以下检查:
检查项问题
证据验证修复方案是否解决了 exact 错误消息?是否处理了显示的数据状态?是否能阻止所有同类事件?
回归风险修复是否会破坏现有功能?是否影响其他代码路径?是否向后兼容?
完整性是否存在其他类似代码模式?是否有相关的Sentry问题?是否需要添加监控/日志?
自我验证修复的是根本原因还是仅处理表象?是否考虑了所有事件数据?如果问题再次出现是否能处理?

Phase 7: Report Results

阶段7:报告结果

Format:
undefined
格式:
undefined

Fixed: [ISSUE_ID] - [Error Type]

Fixed: [ISSUE_ID] - [Error Type]

  • Error: [message], Frequency: [X events, Y users], First/Last: [dates]
  • Root Cause: [one paragraph]
  • Evidence: Stack trace [key frames], breadcrumbs [actions], context [data]
  • Fix: File(s) [paths], Change [description]
  • Verification: [ ] Exact condition [ ] Edge cases [ ] No regressions [ ] Tests [y/n]
  • Follow-up: [additional issues, monitoring, related code]
undefined
  • Error: [message], Frequency: [X events, Y users], First/Last: [dates]
  • Root Cause: [one paragraph]
  • Evidence: Stack trace [key frames], breadcrumbs [actions], context [data]
  • Fix: File(s) [paths], Change [description]
  • Verification: [ ] Exact condition [ ] Edge cases [ ] No regressions [ ] Tests [y/n]
  • Follow-up: [additional issues, monitoring, related code]
undefined

Quick Reference

快速参考

MCP Tools:
sentry_search_issues
,
sentry_get_issue
,
sentry_get_event
,
sentry_get_trace
,
sentry_get_replay
,
sentry_list_projects
,
sentry_get_project
Common Patterns: TypeError (check data flow, API responses, race conditions) • Promise Rejection (trace async, error boundaries) • Network Error (breadcrumbs, CORS, timeouts) • ChunkLoadError (deployment, caching, splitting) • Rate Limit (trace patterns, throttling) • Memory/Performance (trace spans, N+1 queries)
MCP工具:
sentry_search_issues
,
sentry_get_issue
,
sentry_get_event
,
sentry_get_trace
,
sentry_get_replay
,
sentry_list_projects
,
sentry_get_project
常见错误模式: TypeError(检查数据流、API响应、竞态条件)• Promise Rejection(追踪异步逻辑、错误边界)• Network Error(检查Breadcrumbs、CORS、超时)• ChunkLoadError(部署、缓存、代码拆分问题)• Rate Limit(追踪调用模式、限流)• 内存/性能问题(追踪Span、N+1查询)