
Error Patterns
- 93 installs
- 325 repo stars
- Updated August 2, 2026
- athola/claude-night-market
error-patterns is an agent skill that defines multi-agent error categories, first actions, and a three-tier escalation ladder from self-recovery to human handoff.
About
Agent Damage Control (error-patterns) is a Claude Night Market skill that gives solo builders and small teams a shared vocabulary for multi-agent failures. Instead of treating every stall as a generic retry, it classifies issues like agent crashes, context overflow, merge conflicts after parallel edits, and mixed partial failures—each with a first-action table. A three-tier escalation ladder keeps recovery cheap at the agent level, escalates to a lead coordinator after repeated failure, and brings a human in only when severity or deadlock demands it. The patterns extend familiar transient versus permanent error thinking into agent coordination, which matters when you run several specialized agents on one repo. Use it whenever parallel agent work risks file conflicts or silent truncation, not only after incidents in production monitoring.
- Four agent error categories mapped from service-level taxonomy (crash, context overflow, merge conflict, partial failure
- Three-tier escalation: self-recovery → lead agent → human with full context
- Merge-conflict playbook: stop parallel work, resolve, then resume
- Heartbeat and reassignment guidance when an agent stops responding
- Truncation handling via summarize state and continuation handoff
Error Patterns by the numbers
- 93 all-time installs (skills.sh)
- Ranked #4,673 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Security screen: LOW risk (skills.sh audit)
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/athola/claude-night-market --skill error-patternsAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 93 |
|---|---|
| repo stars | ★ 325 |
| Security audit | 3 / 3 scanners passed |
| Last updated | August 2, 2026 |
| Repository | athola/claude-night-market ↗ |
What it does
Recover gracefully when multiple coding agents crash, overflow context, or conflict on files using a defined escalation ladder.
Who is it for?
Best when you're orchestrating multiple agents on one codebase and need merge-conflict stops and crash reassignment without ad-hoc firefighting.
Skip if: Single-threaded one-agent sessions with no parallelism, or pure application runtime errors with no agent coordination angle.
When should I use this skill?
Multi-agent work hits crashes, context limits, file conflicts, truncation, or partial completion and you need categorized first actions and escalation.
What you get
You classify the failure, run the tier-1 playbook (retry, context shed, or conflict stop), escalate to lead reassignment or human review with a state summary when automated recovery fails twice.
- Classified error category and recommended first action
- Escalation tier decision with context summary for human handoff
- Conflict-resolution stop/resume checklist for parallel agents
By the numbers
- 4 agent-level error categories with mapped service equivalents
- 3-tier escalation ladder with handoff after 2 failed self-recovery attempts
Files
Table of Contents
- Overview
- When to Use
- Error Classification
- By Severity
- By Recoverability
- Quick Start
- Standard Error Handler
- Error Result
- Common Patterns
- Authentication Errors (401/403))
- Rate Limit Errors (429))
- Timeout Errors
- Context Too Large (400))
- Integration Pattern
- Detailed Resources
- Exit Criteria
Error Patterns
Overview
Standardized error handling patterns for consistent, production-grade behavior across plugins. Provides error classification, recovery strategies, and debugging workflows.
When To Use
- Building resilient integrations
- Need consistent error handling
- Want graceful degradation
- Debugging production issues
When NOT To Use
- Project doesn't use the leyline infrastructure patterns
- Simple scripts without service architecture needs
Error Classification
By Severity
| Level | Action | Example |
|---|---|---|
| Critical | Halt, alert | Auth failure, service down |
| Error | Retry or secondary strategy | Rate limit, timeout |
| Warning | Log, continue | Partial results, deprecation |
| Info | Log only | Non-blocking issues |
By Recoverability
class ErrorCategory(Enum):
TRANSIENT = "transient" # Retry likely to succeed
PERMANENT = "permanent" # Retry won't help
CONFIGURATION = "config" # User action needed
RESOURCE = "resource" # Quota/limit issueVerification: Run the command with --help flag to verify availability.
Quick Start
Standard Error Handler
from leyline.error_patterns import handle_error, ErrorCategory
try:
result = service.execute(prompt)
except RateLimitError as e:
return handle_error(e, ErrorCategory.RESOURCE, {
"retry_after": e.retry_after,
"service": "gemini"
})
except AuthError as e:
return handle_error(e, ErrorCategory.CONFIGURATION, {
"action": "Run 'gemini auth login'"
})Verification: Run the command with --help flag to verify availability.
Error Result
@dataclass
class ErrorResult:
category: ErrorCategory
message: str
recoverable: bool
suggested_action: str
metadata: dictVerification: Run the command with --help flag to verify availability.
Common Patterns
Authentication Errors (401/403)
- Verify credentials exist
- Check token expiration
- Validate permissions/scopes
- Suggest re-authentication
Rate Limit Errors (429)
- Extract retry-after header
- Log for quota tracking
- Implement backoff
- Consider alternative service
Timeout Errors
- Increase timeout for retries
- Break into smaller requests
- Use async patterns
- Consider different model
Context Too Large (400)
- Estimate tokens before request
- Split into multiple requests
- Reduce input content
- Use larger context model
Integration Pattern
# In your skill's frontmatter
dependencies: [leyline:error-patterns]Verification: Run the command with --help flag to verify availability.
Detailed Resources
- Classification: See
modules/classification.mdfor error taxonomy - Recovery: See
modules/recovery-strategies.mdfor handling patterns - Agent Damage Control: See
modules/agent-damage-control.mdfor multi-agent error recovery and escalation
Exit Criteria
- Error classified correctly
- Appropriate recovery attempted
- User-actionable message provided
- Error logged for debugging
Agent Damage Control
Agent-level error recovery patterns for multi-agent coordination. Maps service-level error categories to agent-level equivalents and defines escalation ladders.
Error Categories
Agent-level error categories extend the service-level taxonomy from error-patterns:
| Agent Category | Service Equivalent | Severity | Recovery |
|---|---|---|---|
| AGENT_CRASH | PERMANENT | Critical | Replace agent, reassign tasks |
| CONTEXT_OVERFLOW | RESOURCE | Error | Graceful handoff, context shed |
| MERGE_CONFLICT | TRANSIENT | Warning | Stop, resolve, resume |
| PARTIAL_FAILURE | Mixed | Varies | Triage by sub-category |
Escalation Ladder
Three-tier escalation with clear handoff points:
Tier 1: Agent Self-Recovery
Agent detects issue, attempts automated recovery
(retry, context shed, conflict resolution)
|
| Fails after 2 attempts
v
Tier 2: Lead Agent Intervention
Lead reassigns tasks, spawns replacement agents,
coordinates resolution across team
|
| Cannot resolve or CRITICAL severity
v
Tier 3: Human Escalation
Human notified with full context, recommended actions,
and current state summaryQuick Reference
| Scenario | First Action |
|---|---|
| Agent stops responding | Check heartbeat, reassign tasks |
| Response truncation | Summarize state, create continuation |
| File conflicts after parallel work | Stop agents, lead resolves |
| Some tasks fail, others succeed | Triage by error category |
Recovery Patterns
Agent Crash Recovery
- Detect orphaned tasks via heartbeat monitoring
- Apply "replace don't wait" doctrine: spawn new agent immediately
- Recover state from last checkpoint or committed work
- Reassign orphaned tasks to replacement agent
Context Overflow Handling
- Detection signals: truncated responses, repeated content, loss of coherence
- Graceful handoff: summarize state, write to file, spawn continuation
- Progressive context shedding: drop least-relevant loaded modules first
Merge Conflict Resolution
- Stop all agents working on conflicting files
- Lead agent resolves conflicts using diff analysis
- Resume agents with updated base after resolution
- Prevention: assign non-overlapping file scopes
Partial Failure Handling
- Triage: categorize each sub-task result (success/failure/partial)
- Salvage: commit successful work first
- Retry: attempt failed tasks with fresh context
- Report: document what succeeded and what needs manual attention
Integration
Reference specific recovery patterns from orchestrator skills:
On agent crash: follow leyline:error-patterns/modules/agent-damage-control.mdExit Criteria
- Failed agent identified and replaced (or escalated)
- Orphaned tasks reassigned to healthy agents
- Successful work preserved and committed
- Recovery actions logged for post-mortem
Error Classification
HTTP Status Code Mapping
ERROR_CLASSIFICATION = {
# Authentication
401: ErrorCategory.CONFIGURATION,
403: ErrorCategory.CONFIGURATION,
# Client errors
400: ErrorCategory.PERMANENT,
404: ErrorCategory.CONFIGURATION,
422: ErrorCategory.PERMANENT,
# Rate limits
429: ErrorCategory.RESOURCE,
# Server errors (transient)
500: ErrorCategory.TRANSIENT,
502: ErrorCategory.TRANSIENT,
503: ErrorCategory.TRANSIENT,
504: ErrorCategory.TRANSIENT,
}Error Detection Patterns
By Message Content
def classify_by_message(error_msg: str) -> ErrorCategory:
error_msg = error_msg.lower()
if any(k in error_msg for k in ["rate limit", "quota", "exceeded"]):
return ErrorCategory.RESOURCE
if any(k in error_msg for k in ["auth", "token", "credential", "permission"]):
return ErrorCategory.CONFIGURATION
if any(k in error_msg for k in ["timeout", "connection", "network"]):
return ErrorCategory.TRANSIENT
if any(k in error_msg for k in ["invalid", "malformed", "syntax"]):
return ErrorCategory.PERMANENT
return ErrorCategory.TRANSIENT # Default: assume retryableService-Specific Errors
Gemini Errors
| Error | Category | Recovery |
|---|---|---|
| RESOURCE_EXHAUSTED | Resource | Wait for quota reset |
| INVALID_ARGUMENT | Permanent | Fix request format |
| PERMISSION_DENIED | Config | Check API key |
| DEADLINE_EXCEEDED | Transient | Retry with backoff |
Qwen Errors
| Error | Category | Recovery |
|---|---|---|
| RateLimitReached | Resource | Wait or switch service |
| InvalidAPIKey | Config | Verify QWEN_API_KEY |
| ModelNotFound | Config | Check model name |
| ServerError | Transient | Retry |
Error Hierarchy
class LeylineError(Exception):
"""Base error for leyline infrastructure."""
category = ErrorCategory.TRANSIENT
class AuthenticationError(LeylineError):
"""Authentication/authorization failures."""
category = ErrorCategory.CONFIGURATION
class RateLimitError(LeylineError):
"""Rate limit or quota exceeded."""
category = ErrorCategory.RESOURCE
class ServiceUnavailableError(LeylineError):
"""Service temporarily unavailable."""
category = ErrorCategory.TRANSIENT
class ConfigurationError(LeylineError):
"""Missing or invalid configuration."""
category = ErrorCategory.CONFIGURATIONRecovery Strategies
Strategy Selection
def select_recovery_strategy(error: LeylineError) -> RecoveryStrategy:
strategies = {
ErrorCategory.TRANSIENT: RetryWithBackoff(),
ErrorCategory.RESOURCE: WaitOrSecondary(),
ErrorCategory.CONFIGURATION: UserActionRequired(),
ErrorCategory.PERMANENT: ReportAndAbort(),
}
return strategies[error.category]Retry With Backoff
class RetryWithBackoff:
def __init__(self, max_retries=3, base_delay=1.0):
self.max_retries = max_retries
self.base_delay = base_delay
def execute(self, operation, *args, **kwargs):
for attempt in range(self.max_retries):
try:
return operation(*args, **kwargs)
except LeylineError as e:
if e.category != ErrorCategory.TRANSIENT:
raise
if attempt < self.max_retries - 1:
delay = self.base_delay * (2 ** attempt)
time.sleep(delay)
raise MaxRetriesExceededError()Wait or Secondary
class WaitOrSecondary: def execute(self, error: RateLimitError, secondary_service=None): retry_after = error.metadata.get("retry_after", 60)
if retry_after < 30: # Short wait time.sleep(retry_after) return "retry"
if secondary_service: return ("secondary", secondary_service)
return ("defer", retry_after)
## User Action Required
class UserActionRequired: def execute(self, error: ConfigurationError) -> dict: actions = { "auth": "Run '{service} auth login' or set {ENV_VAR}", "model": "Check available models with '{service} --help'", "config": "Verify configuration in ~/.claude/leyline/", }
return { "status": "user_action_required", "message": error.message, "suggested_action": actions.get( error.metadata.get("type"), "Check service documentation" ) }
## Graceful Degradation
def execute_with_degradation( primary_fn, secondary_fn=None,
degraded_fn=None ): """Execute with graceful degradation.""" try: return primary_fn() except LeylineError as e: if e.category == ErrorCategory.TRANSIENT and secondary_fn: return secondary_fn() if degraded_fn: return degraded_fn(partial=True) raise
## Logging and Alerting
def log_error_with_context(error: LeylineError, context: dict): """Log error with full context for debugging.""" log_entry = { "timestamp": datetime.utcnow().isoformat(), "error_type": type(error).__name__, "category": error.category.value, "message": str(error), "recoverable": error.category in [ ErrorCategory.TRANSIENT, ErrorCategory.RESOURCE ], "context": context }
logger.error(json.dumps(log_entry))
Alert on critical errors
if error.category == ErrorCategory.PERMANENT: send_alert(log_entry)
Related skills
How it compares
Use for agent-team incident response—not as a substitute for application error monitoring or Sentry-style stack traces.
FAQ
Who is error-patterns for?
Developers and leads running multi-agent Claude or Cursor workflows who need structured recovery when agents conflict, crash, or lose context.
When should I use error-patterns?
During Build when parallel agents edit the same repo; during Ship when merge conflicts appear after automated review branches; during Operate when agents hang, truncate, or partially complete coordinated tasks.
Is error-patterns safe to install?
It is guidance-only; review the Security Audits panel on this page and ensure escalation steps do not auto-run destructive git commands without your approval.