Skip to content
Development
Command

/fix-error

Analyzes error messages to identify root causes, predict resolution time, and suggest proven fixes. Learns patterns from similar errors to provide immediate solutions.

From plugin
claude-code-cookbook
1.1k39 skills9 agents39 commands8 MCP
Install
> /plugin marketplace add wasabeef/claude-code-cookbook

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/fix-error

Context preview

What this command does when you run it.

Analyzes error messages to identify root causes, predict resolution time, and suggest proven fixes. Learns patterns from similar errors to provide immediate solutions.

Command definition

fix-error.md

Identify root cause and suggest proven solutions

Analyzes error messages to identify root causes, predict resolution time, and suggest proven fixes. Learns patterns from similar errors to provide immediate solutions.

Usage

/fix-error [options]

Options

  • None: Standard error analysis
  • `--deep`: Deep dive including dependencies and environment
  • `--preventive`: Focus on preventing future occurrences
  • `--quick`: Quick fixes only

Basic Examples

# Standard error analysis
npm run build 2>&1
/fix-error
"Analyze this build error and suggest fixes"

# Deep analysis mode
python app.py 2>&1
/fix-error --deep
"Find the root cause, including environment issues"

# Quick fixes only
cargo test 2>&1
/fix-error --quick
"Just give me a quick fix"

# Prevention-focused
./app 2>&1 | tail -50
/fix-error --preventive
"Fix this and help me prevent it next time"

Collaboration with Claude

# Analyze error logs
cat error.log
/fix-error
"What's causing this error and how do I fix it?"

# Resolve test failures
npm test 2>&1
/fix-error --quick
"These tests are failing - need a quick fix"

# Analyze stack traces
python script.py 2>&1
/fix-error --deep
"Dig into this stack trace and check for environment issues"

# Handle multiple errors
grep -E "ERROR|WARN" app.log | tail -20
/fix-error
"Sort these by priority and tell me how to fix each one"

Error Resolution Time Prediction

πŸš€ Immediate Fix (< 5 minutes)
β”œβ”€ Typos, missing imports
β”œβ”€ Environment variables not set
β”œβ”€ Undefined variable references
└─ Predicted time: 2-5 minutes

⚑ Quick Fix (< 30 minutes)
β”œβ”€ Dependency version conflicts
β”œβ”€ Configuration file errors
β”œβ”€ Type mismatches
└─ Predicted time: 10-30 minutes

πŸ”§ Investigation Required (< 2 hours)
β”œβ”€ Complex logic errors
β”œβ”€ Async processing race conditions
β”œβ”€ API integration issues
└─ Predicted time: 30 minutes-2 hours

πŸ”¬ Deep Analysis (Half day or more)
β”œβ”€ Architecture-related issues
β”œβ”€ Multi-system integration problems
β”œβ”€ Performance degradation
└─ Predicted time: 4 hours-several days

Similar Error Pattern Database

Common Errors and Immediate Solutions
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

πŸ“Š "Cannot read property 'X' of undefined/null" (Frequency: Extremely High)
β”œβ”€ Primary cause: Insufficient null checks on objects
β”œβ”€ Resolution time: 5-10 minutes
└─ Solution: Add Optional chaining (?.) or null checks

πŸ“Š "ECONNREFUSED" / "ENOTFOUND" (Frequency: High)
β”œβ”€ Primary cause: Service not running or URL misconfiguration
β”œβ”€ Resolution time: 5-15 minutes
└─ Solution: Check service startup, environment variables

πŸ“Š "Module not found" / "Cannot resolve" (Frequency: High)
β”œβ”€ Primary cause: Package not installed, incorrect path
β”œβ”€ Resolution time: 2-5 minutes
└─ Solution: Run npm install, check relative paths

πŸ“Š "Unexpected token" / "SyntaxError" (Frequency: Medium)
β”œβ”€ Primary cause: Bracket/quote mismatch, reserved word usage
β”œβ”€ Resolution time: 2-10 minutes
└─ Solution: Check syntax highlighting, run linter

πŸ“Š "CORS policy" / "Access-Control-Allow-Origin" (Frequency: Medium)
β”œβ”€ Primary cause: Insufficient CORS configuration on server
β”œβ”€ Resolution time: 15-30 minutes
└─ Solution: Configure server CORS, setup proxy

πŸ“Š "Maximum call stack size exceeded" (Frequency: Low)
β”œβ”€ Primary cause: Infinite loops/recursion, circular references
β”œβ”€ Resolution time: 30 minutes-2 hours
└─ Solution: Check recursion termination conditions, resolve circular references

Error Analysis Priority Matrix

| Priority | Icon | Impact Range | Resolution Difficulty | Response Deadline | Description | | ----------------- | ------------------- | ------------ | --------------------- | ---------------------- | ------------------------------------------------ | | **Critical** | πŸ”΄ Emergency | Wide | Low | Start within 15 min | System-wide outage, data loss risk | | **High Priority** | 🟠 Early Response | Wide | High | Start within 1 hour | Major feature outage, many users affected | | **Medium** | 🟑 Planned Response | Narrow | High | Address same day | Partial feature limitation, workaround available | | **Low** | 🟒 Monitor | Narrow | Low | Next maintenance cycle | Minor bugs, minimal UX impact |

Analysis Process

Phase 1: Error Information Collection

πŸ”΄ Must have:
- Full error message
- Stack trace
- Steps to reproduce

🟑 Should have:
- Environment details (OS, versions, dependencies)
- Recent changes (git log, commits)
- Related logs

🟒 Nice to have:
- System resources
- Network state
- External services

Phase 2: Root Cause Analysis

1. **Identify symptoms**

  • Exact error message
  • When and how it happens
  • What's affected

2. **Find root causes**

  • Use 5 Whys analysis
  • Check dependencies
  • Compare environments

3. **Test your theory**

  • Create minimal repro
  • Isolate the issue
  • Confirm the cause

Phase 3: Solution Implementation

πŸ”΄ Quick fix (hotfix):
- Stop the bleeding
- Apply workarounds
- Get ready to deploy

🟑 Root cause fix:
- Fix the actual problem
- Add tests
- Update docs

🟒 Prevent future issues:
- Better error handling
- Add monitoring
- Improve CI/CD

Output Example

🚨 Error Analysis Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

πŸ“ Error Overview
β”œβ”€ Type: [Compilation/Runtime/Logical/Environmental]
β”œβ”€ Urgency: πŸ”΄ High / 🟑 Medium / 🟒 Low
β”œβ”€ Impact Scope: [Feature name/Component]
└─ Reproducibility: [100% / Intermittent / Specific conditions]

πŸ” Root Cause
β”œβ”€ Direct Cause: [Specific cause]
β”œβ”€ Background Factors: [Environment/Configuration/Dependencies]
└─ Trigger: [Occurrence conditions]

πŸ’‘ Solutions
πŸ”΄ Immediate response:
1. [Specific fix command/code]
2. [Temporary workaround]

🟑 Fundamental
Read more
Ships withclaude-code-cookbook

A collection of commands, roles, and automation scripts for Claude Code. Automate your workflow without unnecessary confirmations, allowing you to focus on what matters.

Get the whole plugin