Error Types
Codebuff uses HTTP-style status codes for error classification:Retryable Errors
These errors trigger automatic retry:- 408 Request Timeout: Request took too long
- 429 Too Many Requests: Rate limit exceeded
- 500 Internal Server Error: Server-side error
- 502 Bad Gateway: Upstream service error
- 503 Service Unavailable: Temporary unavailability
- 504 Gateway Timeout: Upstream timeout
Error Factory Functions
Codebuff provides convenient functions for creating specific error types:HTTP Errors
Authentication Errors (401)
Forbidden Errors (403)
Payment Required Errors (402)
Server Errors (500)
Network Errors (503)
Extracting Error Status Codes
Codebuff provides utilities to extract status codes from different error formats:Retry Configuration
Codebuff implements exponential backoff for automatic retries.Retry Constants
Retry Timing
- Max retries: 3 attempts
- First retry: 1 second delay
- Second retry: 2 seconds delay
- Third retry: 4 seconds delay
- Max delay: Capped at 8 seconds
Exponential Backoff Pattern
Reconnection Handling
After network reconnection:- Show reconnection message for 2 seconds
- Wait 500ms for connection to stabilize
- Retry failed messages with exponential backoff
Error Sanitization
Sanitize errors before displaying to users:Handling Common Errors
Rate Limiting (429)
Authentication Failures (401)
Network Errors
File System Errors
Debugging Tips
Enable Verbose Logging
Inspect Error Details
Check Credentials
Monitor Retries
Error Recovery Patterns
Graceful Degradation
Retry with Backoff
Next Steps
- Learn about Model Providers
- Explore Credentials Management
- See File System Access

