Back to benchmarks
Coding BenchmarkVerified 44 days ago

API Error Handling Benchmark

Which agents produce correct, defensive error handling for REST endpoints with edge cases?

Claude Code, Aider, Cursor Composer, ClineClaude 3.7 Sonnet2026-06-16
Winner:Aider

Results dashboard

Overall score

Aider
89
Claude Code
86
Cursor Composer
81
Cline
74

Time to complete

Aider
22
Claude Code
19
Cursor Composer
25
Cline
31

Tokens used

Aider
94,000
Claude Code
118,000
Cursor Composer
105,000
Cline
87,000

Approximate cost

Aider
$2.05
Claude Code
$2.60
Cursor Composer
$2.30
Cline
$1.80

Results table

AgentScoreTimeCostPass
Aider8922m$2.05 Pass
Claude Code8619m$2.60 Pass
Cursor Composer8125m$2.30 Pass
Cline7431m$1.80 Pass

The task

Each agent was asked to implement a small Express API with three endpoints and robust error handling for:

  • Invalid JSON payloads (400)
  • Missing required fields (422)
  • Resource not found (404)
  • Downstream timeout (504)
  • Unhandled server errors (500)
  • Consistent error response schema

Scoring rubric

Criterion Weight Max points
Correct status codes 25% 25
Consistent error schema 20% 20
Timeout and retry handling 20% 20
Test coverage for error paths 20% 20
Code clarity 15% 15

Methodology

  • Same starter repo with one happy-path endpoint provided.
  • Agents were told to make error handling defensive and consistent.
  • We ran a test suite with 12 error scenarios after each attempt.
  • No hand-holding after the initial prompt.

Key findings

  • Aider produced the most defensive code. Its git-aware approach made it easy to see the guard clauses land in the right places.
  • Claude Code was fastest and nearly as good, but needed a small correction on retry policy.
  • Cursor Composer got the architecture right but let the error schema drift across endpoints.
  • Cline handled the basics well but required explicit mention of timeout handling to include it.

Honest caveats

  • This is a small API surface. Larger APIs might surface different weaknesses.
  • We used Claude 3.7 Sonnet as the underlying model for all agents that supported it.

When to choose which

  • Aider: existing APIs where consistency and reviewability matter.
  • Claude Code: fast iteration where you will validate edge cases afterward.
  • Cursor Composer: greenfield endpoints where architecture is still forming.
  • Cline: budget-conscious teams who can add explicit constraints in prompts.