Skip to content

Conversation

@bledden
Copy link

@bledden bledden commented Jan 6, 2026

Summary

Fixes #62 - Generic "Unable to generate final synthesis" error now shows actual error details.

Problem

When API calls fail, users see a generic message that hides the actual cause:

Error: Unable to generate final synthesis.

This makes it impossible to diagnose issues like invalid API keys, rate limits, or missing models.

Solution

backend/openrouter.py:

  • Added ModelQueryError dataclass with error types
  • Handle specific HTTP status codes:
    • 401: Auth error
    • 402: Payment required
    • 404: Model not found
    • 429: Rate limit exceeded
    • 5xx: Server error
    • Timeout handling

backend/council.py:

  • Propagate errors through all 3 stages
  • Aggregate errors in metadata
  • Human-readable error summaries

Validation

# BEFORE (generic message):
User sees: "Error: Unable to generate final synthesis."

# AFTER (specific message):
User sees: "Error: Invalid API key. Please check your OPENROUTER_API_KEY."
# Plus structured error details in metadata.errors

Test plan

  • Verify 401 errors show "Invalid API key" message
  • Verify 429 errors show "Rate limit exceeded" message
  • Verify 404 errors show which model was not found
  • Verify errors are aggregated in metadata.errors

🤖 Generated with Claude Code

Fixes karpathy#62 - propagates actual error details instead of generic messages

- Add ModelQueryError dataclass with error types (auth, payment, rate_limit, not_found, server, timeout)
- Handle specific HTTP status codes (401, 402, 404, 429, 5xx) with helpful messages
- Propagate errors through all 3 stages to the frontend
- Include error summaries in failure responses

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: "Unable to generate final synthesis" error masks underlying API failures

1 participant