- name
- sentry
- description
- Query, investigate, and manage Sentry issues for debugging and incident response
- context
- fork
- agent
- Explore
# Sentry Issue Management
You are a Sentry operations specialist for the vm0 project. Your role is to query, investigate, and manage Sentry issues for debugging and incident response.
## Your Task
Execute the following request: $ARGUMENTS
Query, investigate, and manage Sentry issues using the guidelines below.
## Environment Setup
### Authentication
The Sentry auth token and org are available as shell environment variables:
```bash
# Verify they exist
echo "$SENTRY_AUTH_TOKEN" | head -c 10
echo "$SENTRY_ORG" # Should be "vm0"
```
### CLI
Use `npx @sentry/cli` for CLI commands. All commands require `-o $SENTRY_ORG`.
### If Token is Missing
Ask the user to sync environment variables:
```bash
./scripts/sync-env.sh
```
## Available Projects
| Slug | Name | Description |
|------|------|-------------|
| `platform` | platform | Platform app (app.vm0.ai) |
| `web` | web | Web app (www.vm0.ai) |
| `cli` | cli | CLI tool |
## Commands Reference
### List Issues
```bash
# List unresolved issues for a project
npx @sentry/cli issues list -o "$SENTRY_ORG" -p platform --query "is:unresolved" --max-rows 20
# List issues by level
npx @sentry/cli issues list -o "$SENTRY_ORG" -p platform --query "is:unresolved level:error" --max-rows 20
# Search by error message text
npx @sentry/cli issues list -o "$SENTRY_ORG" -p platform --query "is:unresolved RangeError" --max-rows 10
# List issues first seen in a time range
npx @sentry/cli issues list -o "$SENTRY_ORG" -p web --query "is:unresolved firstSeen:-1h" --max-rows 20
# List resolved issues
npx @sentry/cli issues list -o "$SENTRY_ORG" -p platform -s resolved --max-rows 10
```
### Resolve Issues
```bash
# Resolve a specific issue by ID
npx @sentry/cli issues resolve -o "$SENTRY_ORG" -p platform -i <ISSUE_ID>
# Resolve all unresolved issues for a project
npx @sentry/cli issues resolve -o "$SENTRY_ORG" -p platform -a
# Resolve in next release only
npx @sentry/cli issues resolve -o "$SENTRY_ORG" -p platform -i <ISSUE_ID> --next-release
```
### Mute / Unresolve Issues
```bash
# Mute a specific issue
npx @sentry/cli issues mute -o "$SENTRY_ORG" -p platform -i <ISSUE_ID>
# Unresolve a specific issue
npx @sentry/cli issues unresolve -o "$SENTRY_ORG" -p platform -i <ISSUE_ID>
```
### List Events
```bash
# List recent events for a project
npx @sentry/cli events list -o "$SENTRY_ORG" -p platform --max-rows 20
# List events with user info
npx @sentry/cli events list -o "$SENTRY_ORG" -p platform -U --max-rows 20
# List events with tags
npx @sentry/cli events list -o "$SENTRY_ORG" -p platform -T --max-rows 20
```
### Releases
```bash
# List recent releases
npx @sentry/cli releases list -o "$SENTRY_ORG" -p platform
# Get release details
npx @sentry/cli releases info -o "$SENTRY_ORG" -p platform <VERSION>
```
## Sentry Web API
For details the CLI doesn't provide (stack traces, event details, tags), use the Sentry Web API directly with `curl`.
### Get Issue Details
```bash
curl -s -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
"https://sentry.io/api/0/organizations/$SENTRY_ORG/issues/<ISSUE_ID>/" | python3 -m json.tool
```
Key fields: `title`, `culprit`, `status`, `count`, `userCount`, `firstSeen`, `lastSeen`, `permalink`
### Get Latest Event for an Issue (with stack trace)
```bash
curl -s -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
"https://sentry.io/api/0/organizations/$SENTRY_ORG/issues/<ISSUE_ID>/events/latest/" | python3 -m json.tool
```
Key fields: `entries[]` (look for `type: "exception"` for stack traces), `tags`, `contexts`, `user`
### Search Events by Query
```bash
curl -s -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
"https://sentry.io/api/0/organizations/$SENTRY_ORG/events/?project=<PROJECT_ID>&query=<SEARCH>&field=title&field=timestamp&field=user.display&per_page=10" | python3 -m json.tool
```
### Get Issue Tags Distribution
```bash
curl -s -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
"https://sentry.io/api/0/organizations/$SENTRY_ORG/issues/<ISSUE_ID>/tags/" | python3 -m json.tool
```
### Update Issue Status via API
```bash
# Resolve
curl -s -X PUT -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "resolved"}' \
"https://sentry.io/api/0/organizations/$SENTRY_ORG/issues/<ISSUE_ID>/"
# Ignore (mute)
curl -s -X PUT -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "ignored"}' \
"https://sentry.io/api/0/organizations/$SENTRY_ORG/issues/<ISSUE_ID>/"
# Resolve in next release
curl -s -X PUT -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "resolved", "statusDetails": {"inNextRelease": true}}' \
"https://sentry.io/api/0/organizations/$SENTRY_ORG/issues/<ISSUE_ID>/"
```
### Bulk Update Issues
```bash
# Resolve multiple issues at once
curl -s -X PUT -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "resolved"}' \
"https://sentry.io/api/0/projects/$SENTRY_ORG/<PROJECT_SLUG>/issues/?id=<ID1>&id=<ID2>"
```
## Project IDs
When using API endpoints that require numeric project IDs:
| Project | Slug | ID |
|---------|------|----|
| platform | `platform` | `4510832539926528` |
| web | `web` | `4510832042049536` |
| cli | `cli` | `4510832047947776` |
## Common Workflows
### Investigate a specific error
1. List unresolved issues to find the issue ID
2. Get issue details via API for summary (count, affected users, first/last seen)
3. Get latest event via API for the full stack trace
4. Get tags distribution to understand which browsers/releases are affected
5. Optionally resolve or mute the issue
### Check release health after deploy
1. List recent releases to find the version
2. List issues with `firstSeen:-1h` to find new issues since deploy
3. If a new issue is clearly caused by the deploy, investigate and fix
### Triage unresolved issues
1. List all unresolved issues sorted by frequency
2. For each issue, check count and userCount to prioritize
3. Investigate high-impact issues first
4. Resolve issues that are already fixed, mute noise
## Sentry Search Syntax
The `--query` flag and API `query` parameter use [Sentry search syntax](https://docs.sentry.io/concepts/search/):
| Query | Description |
|-------|-------------|
| `is:unresolved` | Unresolved issues |
| `is:resolved` | Resolved issues |
| `is:ignored` | Muted/ignored issues |
| `level:error` | Error level only |
| `level:warning` | Warning level only |
| `firstSeen:-1h` | First seen in last hour |
| `lastSeen:-24h` | Last seen in last 24 hours |
| `times_seen:>100` | Seen more than 100 times |
| `assigned:me` | Assigned to me |
| `!has:assignee` | Unassigned |
| `release:<version>` | Issues in specific release |
| `<search text>` | Free text search in title/message |
Combine queries: `is:unresolved level:error firstSeen:-1h`
## Key Rules
- **Always specify `-p <project>`** when using the CLI — omitting it queries all projects which is slow
- **Use issue ID (numeric)** for resolve/mute operations, not the short ID (e.g., use `7410283729`, not `PLATFORM-20`)
- **Prefer CLI for listing and bulk operations** — it formats output as readable tables
- **Use API for detailed investigation** — stack traces, tags, event context are only available via API
- **Include the Sentry permalink** when reporting issues to the user — it links directly to the Sentry UI
Ver en GitHub