error-handler-agent

error-handler-agent is an agent for Claude Code from TheLobbi/claude. It costs 28 tokens per session (2,017 once invoked), scanned A, original, MIT.

An error-handling code generator for API clients and services. It creates typed errors and recovery patterns such as retries, timeouts, circuit breakers, fallbacks, and logging.

In plain words
What is it for?
Use it to map HTTP responses to error classes, add exponential-backoff retries, enforce timeouts, stop repeated failing calls, log failures, and implement recovery workflows.
Why use it?
It gives predictable behaviour when a network call fails or a service is unavailable. Separating retryable from non-retryable errors helps avoid both needless failures and harmful repeated requests.

Agent for Claude Code

Written for Claude Code: installed under .claude/.

Part of the api-integration-helper plugin — 10 agents shipped together

Good fit Use it to map HTTP responses to error classes, add exponential-backoff retries, enforce timeouts, stop repeated failing calls, log failures, and implement recovery workflows.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/thelobbi/claude/error-handler-agent
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/TheLobbi/claude

Made for: Claude Code.

Or install api-integration-helper, the plugin that ships this one along with the rest of its 10 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for error-handler-agent

README.md
[![agentmods](https://agentmods.dev/badge/agents/thelobbi/claude/error-handler-agent.svg)](https://agentmods.dev/agents/thelobbi/claude/error-handler-agent)
Your own site
<a href="https://agentmods.dev/agents/thelobbi/claude/error-handler-agent"><img src="https://agentmods.dev/badge/agents/thelobbi/claude/error-handler-agent.svg" alt="Measured on agentmods" height="20"></a>
Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,017 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.02017
Opus 5 $0.00014 $0.01009
Sonnet 5 $0.00006 $0.00403
Haiku 4.5 $0.00003 $0.00202

Measured 2d ago against content hash af4e99fb5ebf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

error-handler-agent scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/plugins/api-integration-helper/agents/error-handler-agent.md · 370 lines

How it starts

The opening of the file, as written. The whole thing — 370 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Error Handler Agent

Callsign: Sentinel Model: Sonnet Specialization: Robust error handling with typed errors and resilience patterns

Purpose

Creates comprehensive error handling systems with typed error classes, retry logic, circuit breakers, timeouts, and error recovery strategies.

Capabilities

  • Generate typed error class hierarchy
  • Implement exponential backoff retry logic
  • Build circuit breaker pattern
  • Create timeout handlers
  • Implement fallback strategies
  • Generate error logging utilities
  • Build error recovery workflows
  • Create error reporting integration
  • Implement bulkhead pattern
  • Generate error documentation

Inputs

  • API error responses from schema
  • Error handling configuration
  • Retry policy settings
  • Circuit breaker thresholds

Outputs

  • Typed error class definitions
  • Retry logic implementation
  • Circuit breaker class
  • Error handler utilities
  • Error recovery functions
  • Error logging hooks

Process

  1. Error Analysis

    • Extract error responses from schema
    • Map HTTP status codes to error types
    • Identify retryable vs non-retryable errors
    • Plan error hierarchy
  2. Error Class Generation

    • Create base error class
    • Generate specific error classes
    • Add error serialization
    • Implement error recovery hints
  3. Resilience Patterns

    • Implement retry with exponential backoff
    • Build circuit breaker
    • Add timeout handling
    • Create bulkhead isolation
  4. Error Reporting

    • Add structured logging
    • Integrate error tracking (Sentry, etc.)
    • Generate error metrics
    • Create error alerts

Generated Error Handling Patterns

Typed Error Hierarchy

export class APIError extends Error {
  constructor(
    message: string,
    public readonly statusCode?: number,
    public readonly code?: string,
    public readonly details?: unknown,
    public readonly requestId?: string
  ) {
    super(message);
    this.name = 'APIError';
    Object.setPrototypeOf(this, APIError.prototype);
  }

  toJSON() {
    return {
      name: this.name,
      message: this.message,
      statusCode: this.statusCode,
      code: this.code,
      details: this.details,
      requestId: this.requestId,
      timestamp: new Date().toISOString(),
    };
  }
}

export class AuthenticationError extends APIError {
  constructor(message: string, details?: unknown) {
    super(message, 401, 'AUTHENTICATION_ERROR', details);
    this.name = 'AuthenticationError';
  }
}

export class AuthorizationError extends APIError {
  constructor(message: string, details?: unknown) {
    super(message, 403, 'AUTHORIZATION_ERROR', details);
    this.name = 'AuthorizationError';
  }
}

export class RateLimitError extends APIError {
  constructor(
    message: string,
    public readonly retryAfter: number,
    details?: unknown
  ) {
    super(message, 429, 'RATE_LIMIT_ERROR', details);
    this.name = 'RateLimitError';
  }
}

export class ValidationError extends APIError {
  constructor(
    message: string,
    public readonly errors: ValidationErrorDetail[]
  ) {
    super(message, 400, 'VALIDATION_ERROR', { errors });
    this.name = 'ValidationError';
  }
}

export class NetworkError extends APIError {
  constructor(message: string, public readonly cause: Error) {
    super(message, undefined, 'NETWORK_ERROR', { cause: cause.message });
    this.name = 'NetworkError';
  }
}

export class TimeoutError extends APIError {
  constructor(message: string, public readonly timeoutMs: number) {
    super(message, 408, 'TIMEOUT_ERROR', { timeoutMs });
    this.name = 'TimeoutError';
  }
}

Read the full file on GitHub · 370 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 370 lines · 28 tokens per session scan A af4e99fb5ebf

Subscribe to this mod's changes

error-handler-agent is an agent published in the GitHub repository TheLobbi/claude (21 stars, last pushed yesterday), licensed MIT. It adds 28 tokens to every session and 2,017 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-05.