Master error codes, debugging, and retry strategies
All WAVE API errors follow a consistent format
{
"error": {
"code": "invalid_request",
"message": "Missing required field: title",
"details": [
{
"field": "title",
"issue": "required field missing",
"expected": "string (1-200 characters)"
}
],
"request_id": "req_abc123xyz",
"documentation_url": "https://docs.wave.inc/api-reference/errors#invalid_request"
}
}Errors caused by client request issues
Invalid request format or parameters
Example:
Missing required field "title" in stream creationMissing or invalid API key
Example:
API key expired or revokedInsufficient permissions for this resource
Example:
API key lacks "streams:write" scopeResource does not exist
Example:
Stream ID "stream_xyz" not foundResource state conflict
Example:
Stream already active, cannot update while liveValidation error on request body
Example:
Invalid protocol value: must be webrtc, rtmp, or srtRate limit exceeded
Example:
Exceeded 60 requests/minute on free tierErrors from WAVE infrastructure
Unexpected server error
Example:
Database connection failed temporarilyUpstream service unavailable
Example:
Cloudflare Calls temporarily unreachableService temporarily down (maintenance or overload)
Example:
Scheduled maintenance in progressRequest timeout exceeded
Example:
Stream creation took >30 secondsProduction-grade retry patterns with exponential backoff
import { WaveClient } from '@wave/api-client';
import { DesignTokens, getContainer, getSection } from '@/lib/design-tokens';
const client = new WaveClient({
apiKey: 'wave_live_xxxxx',
retry: {
maxAttempts: 3,
initialDelay: 1000, // 1 second
maxDelay: 30000, // 30 seconds
exponentialBase: 2,
retryableStatuses: [408, 429, 500, 502, 503, 504]
}
});
// Automatic retry with exponential backoff
try {
const stream = await client.streams.create({
title: 'My Stream'
});
} catch (error) {
if (error.code === 'rate_limit_exceeded') {
const retryAfter = error.headers['retry-after'];
console.log(`Retry after ${retryAfter} seconds`);
}
throw error;
}Every error response includes a unique request_id. Log this for production debugging.
logger.error('API error', { request_id: error.request_id })Use TypeScript types or JSON Schema validation to catch errors before making API calls.
const validated = StreamSchema.parse(streamData)Set up alerts for high error rates (above 5%) or specific error codes like 429 (rate limiting).
Sentry, Datadog, or CloudWatch for error trackingFor POST/PATCH requests, include an Idempotency-Key header to safely retry.
Idempotency-Key: uuid-v4-generated-on-client