Error triage

From weisser-dev/awesome-opencode · View interactive version

Error triage is an AI agent skill from the GitHub repository weisser-dev/awesome-opencode. Parse stack traces and error logs to identify root cause, find related code, and suggest fixes with severity classification

How to use this skill

Skill file

What I do

When to use me

Use this skill when you need to:

Process

  1. Parse the error: Extract structured information
  1. Identify the root frame: Find where the error originates
  1. Read the source code: Examine the relevant code
  1. Classify the error: Determine type and severity
  1. Diagnose root cause: Explain why the error occurs
  1. Suggest fix: Provide a concrete remediation

Error Classification

By Severity

| Severity | Criteria | Response |

|----------|----------|----------|

| Critical | Data loss, security breach, full outage | Immediate fix required |

| High | Feature broken for all users, degraded performance | Fix within hours |

| Medium | Feature broken for some users, workaround exists | Fix within days |

| Low | Cosmetic, non-blocking, edge case | Fix in next sprint |

By Category

| Category | Examples | Typical Cause |

|----------|----------|---------------|

| Null/Undefined | NPE, TypeError: undefined | Missing null check, uninitialized variable |

| Type Mismatch | ClassCastException, TypeError | Wrong type passed, serialization issue |

| Connection | ConnectionRefused, Timeout | Service down, wrong config, network |

| Authentication | 401, 403, InvalidToken | Expired token, wrong credentials, permissions |

| Validation | 400, ValidationError | Invalid input, schema mismatch |

| Resource | OOM, disk full, file not found | Resource exhaustion, missing file |

| Concurrency | Deadlock, race condition | Shared state, missing synchronization |

| Configuration | Missing env var, invalid config | Missing or incorrect configuration |

Diagnosis Output Format

## Error Diagnosis

**Error:** `TypeError: Cannot read property 'id' of undefined`
**File:** `src/services/user-service.ts:47`
**Severity:** High
**Category:** Null/Undefined

### Root Cause

The `getUser()` function returns `undefined` when the user is not found in the
database, but the caller at line 47 accesses `.id` without a null check.

### Stack Trace Analysis

| # | Location | Notes |
|---|----------|-------|
| 1 | `src/services/user-service.ts:47` | **Root frame** - `.id` access on undefined |
| 2 | `src/handlers/order.ts:23` | Caller that passes userId |
| 3 | `src/routes/api.ts:15` | Route handler |

### Suggested Fix

\`\`\`typescript
// Before
const userName = getUser(userId).id;

// After
const user = getUser(userId);
if (!user) {
  throw new NotFoundError(`User ${userId} not found`);
}
const userName = user.id;
\`\`\`

### Related Considerations

- Check if other callers of `getUser()` have the same issue
- Consider making `getUser()` throw instead of returning undefined
- Add a test case for the "user not found" scenario

Common Patterns

JavaScript/TypeScript

Java

Python

Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.