Skip to main content
← Back to API Reference

Error Handling Guide

Master error codes, debugging strategies, and retry patterns for production systems

API Reference
Error Codes
Best Practices
Retry Patterns

Error Response Structure

All WAVE API errors follow a consistent format for easy parsing

{
  "error": {
    "code": "invalid_request",
    "message": "Missing required field: title",
    "details": [
      {
        "field": "title",
        "issue": "required field missing",
        "expected": "string (1-200 characters)"
      }
    ],
    "request_id": "req_abc123xyz789",
    "documentation_url": "https://docs.wave.inc/api-reference/errors#invalid_request"
  }
}

Response Headers

X-Request-ID: req_abc123xyz789

X-RateLimit-Limit: 1000

X-RateLimit-Remaining: 847

X-RateLimit-Reset: 1705312800

Important Fields

  • request_id - Include in support tickets
  • code - Machine-readable error type
  • details - Field-level validation info
  • documentation_url - Direct link to docs

HTTP Status Codes

Client Errors (4xx)

Errors caused by invalid client requests - fix your request and retry

Server Errors (5xx)

Errors from WAVE infrastructure - retry with exponential backoff

WAVE-Specific Error Codes

STREAM_001

Protocol Mismatch

Incoming stream protocol does not match configured input

{"error": {"code": "STREAM_001", "message": "Expected RTMP but received SRT connection"}}
HTTP 400
streaming

Resolution:

  • Verify encoder is using correct protocol (WebRTC, SRT, RTMP)
  • Check stream key format matches protocol
  • Update stream configuration if changing protocols
STREAM_002

Bitrate Exceeded

Stream bitrate exceeds plan limits or configured maximum

{"error": {"code": "STREAM_002", "message": "Bitrate 15Mbps exceeds plan limit of 10Mbps"}}
HTTP 400
streaming

Resolution:

  • Reduce encoder bitrate to within limits
  • Upgrade to higher plan for increased limits
  • Enable adaptive bitrate for automatic adjustment
STREAM_003

Connection Limit Reached

Maximum concurrent streams for your plan has been reached

{"error": {"code": "STREAM_003", "message": "5/5 concurrent streams active. Upgrade for more."}}
HTTP 429
streaming

Resolution:

  • End inactive streams before starting new ones
  • Upgrade plan for more concurrent streams
  • Use multi-bitrate single stream instead of multiple
STREAM_004

Invalid Stream Key

Stream key is invalid, expired, or already in use

{"error": {"code": "STREAM_004", "message": "Stream key 'sk_live_xxx' is invalid or expired"}}
HTTP 401
streaming

Resolution:

  • Regenerate stream key in dashboard
  • Check stream key has not expired
  • Ensure another encoder is not using the same key
STREAM_005

Codec Unsupported

Video or audio codec is not supported

{"error": {"code": "STREAM_005", "message": "VP9 codec not supported. Use H.264 or enable transcoding."}}
HTTP 400
streaming

Resolution:

  • Use H.264 for video, AAC for audio (standard)
  • Enable transcoding for H.265/HEVC sources
  • Check codec compatibility matrix in docs
TRANSCODE_001

Transcoding Queue Full

Transcoding capacity temporarily exhausted

{"error": {"code": "TRANSCODE_001", "message": "Transcoding queue full. Retry in 30s."}}
HTTP 503
transcoding

Resolution:

  • Retry after 30-60 seconds
  • Consider premium transcoding tier for priority
  • Use passthrough mode if transcoding not required
TRANSCODE_002

Profile Invalid

Specified transcoding profile does not exist or is misconfigured

{"error": {"code": "TRANSCODE_002", "message": "Profile '4k_ultra' not found"}}
HTTP 400
transcoding

Resolution:

  • Use standard profile names: 1080p, 720p, 480p, 360p
  • Verify custom profile exists in your account
  • Check profile parameters are within limits
TRANSCODE_003

Source Quality Insufficient

Source stream quality too low for requested output

{"error": {"code": "TRANSCODE_003", "message": "Cannot upscale 480p source to 1080p output"}}
HTTP 400
transcoding

Resolution:

  • Request output resolutions lower than source
  • Increase source bitrate and resolution
  • Enable upscaling if needed (quality impact)
AUTH_001

Token Expired

JWT or session token has expired

{"error": {"code": "AUTH_001", "message": "Token expired at 2024-01-15T10:00:00Z"}}
HTTP 401
authentication

Resolution:

  • Refresh token using refresh endpoint
  • Re-authenticate user if refresh fails
  • Check token expiry before requests
AUTH_002

Scope Insufficient

API key does not have required scope for this operation

{"error": {"code": "AUTH_002", "message": "Scope 'analytics:read' required but not present"}}
HTTP 403
authentication

Resolution:

  • Check required scopes in API documentation
  • Create new API key with additional scopes
  • Use service account for admin operations
AUTH_003

IP Not Allowed

Request originated from IP address not in allowlist

{"error": {"code": "AUTH_003", "message": "IP 203.0.113.50 not in allowlist"}}
HTTP 403
authentication

Resolution:

  • Add IP to allowlist in security settings
  • Check for proxy/VPN affecting source IP
  • Use API key without IP restrictions for testing
BILLING_001

Payment Required

Account has unpaid invoices blocking operations

{"error": {"code": "BILLING_001", "message": "Payment required. Invoice INV-2024-001 overdue."}}
HTTP 402
billing

Resolution:

  • Update payment method in billing settings
  • Pay outstanding invoices
  • Contact billing support for payment plans
BILLING_002

Plan Limit Reached

Resource usage has reached plan limits

{"error": {"code": "BILLING_002", "message": "500GB storage limit reached on Pro plan"}}
HTTP 403
billing

Resolution:

  • Upgrade to higher plan
  • Enable overage billing if available
  • Optimize resource usage
BILLING_003

Feature Not Available

Feature requires upgrade to access

{"error": {"code": "BILLING_003", "message": "Multi-region requires Enterprise plan"}}
HTTP 403
billing

Resolution:

  • Upgrade to plan that includes feature
  • Contact sales for enterprise features
  • Check feature availability matrix
STORAGE_001

File Too Large

Uploaded file exceeds maximum size limit

{"error": {"code": "STORAGE_001", "message": "File size 15GB exceeds 10GB limit"}}
HTTP 413
storage

Resolution:

  • Compress file before uploading
  • Use chunked upload for large files
  • Request limit increase for enterprise
STORAGE_002

Invalid File Type

File type not accepted for this endpoint

{"error": {"code": "STORAGE_002", "message": "File type 'application/x-rar' not accepted"}}
HTTP 400
storage

Resolution:

  • Check accepted file types in documentation
  • Convert file to supported format
  • Use video upload endpoint for media files
WEBHOOK_001

Delivery Failed

Webhook delivery failed after all retries

{"error": {"code": "WEBHOOK_001", "message": "Delivery failed after 5 attempts to https://api.example.com/webhooks"}}
HTTP 0
webhook

Resolution:

  • Check webhook endpoint is accessible
  • Verify SSL certificate is valid
  • Ensure endpoint responds within 30 seconds
  • Check endpoint returns 2xx status
WEBHOOK_002

Signature Invalid

Webhook signature verification failed

{"error": {"code": "WEBHOOK_002", "message": "Signature mismatch - possible replay attack"}}
HTTP 400
webhook

Resolution:

  • Use correct webhook secret for signature
  • Verify raw request body is used (not parsed)
  • Check timestamp is within tolerance window

Showing 18 of 18 error codes

Retry Strategies & Production Code

Battle-tested retry patterns with exponential backoff across all SDKs

import { WaveClient, WaveError } from '@wave/sdk';

const client = new WaveClient({
  apiKey: process.env.WAVE_API_KEY!,
  retry: {
    maxAttempts: 3,
    initialDelay: 1000,
    maxDelay: 30000,
    exponentialBase: 2,
    jitter: 0.1, // 10% randomization
    retryableStatuses: [408, 429, 500, 502, 503, 504],
  },
});

// Custom retry handler for specific errors
async function createStreamWithRetry(data: CreateStreamInput) {
  try {
    return await client.streams.create(data);
  } catch (error) {
    if (error instanceof WaveError) {
      if (error.code === 'rate_limit_exceeded') {
        const retryAfter = error.headers['retry-after'];
        console.log(`Rate limited. Retrying in ${retryAfter}s`);
        await sleep(retryAfter * 1000);
        return client.streams.create(data);
      }
      if (error.code === 'STREAM_003') {
        // Max streams reached - notify user
        throw new Error('Upgrade required for more streams');
      }
    }
    throw error;
  }
}

Recommended Retry Configuration

ParameterValueDescription
maxAttempts3Total attempts including initial request
initialDelay1000msWait time before first retry
maxDelay30000msMaximum wait between retries
exponentialBase2Multiplier for exponential backoff
jitter0.1Random variance (10%) to prevent thundering herd
retryableStatuses[408, 429, 500, 502, 503, 504]HTTP status codes to retry

Diagnostic Tools & Commands

Quick commands for debugging common issues

Check API Status

Verify WAVE API is responding

curl -s https://api.wave.inc/v1/health | jq .
View expected output
{
  "status": "healthy",
  "latency_ms": 12,
  "region": "us-east-1",
  "version": "2024.01.15"
}

Validate API Key

Check if your API key is valid and see its scopes

curl -s -H "Authorization: Bearer $WAVE_API_KEY" \
  https://api.wave.inc/v1/auth/validate | jq .
View expected output
{
  "valid": true,
  "key_id": "key_live_abc123",
  "scopes": ["streams:read", "streams:write"],
  "expires_at": null
}

Check Rate Limit Status

View your current rate limit consumption

curl -s -I -H "Authorization: Bearer $WAVE_API_KEY" \
  https://api.wave.inc/v1/streams | grep -i "x-ratelimit"
View expected output
x-ratelimit-limit: 1000
x-ratelimit-remaining: 847
x-ratelimit-reset: 1705312800

Get Recent Errors

Fetch recent error events from your account

curl -s -H "Authorization: Bearer $WAVE_API_KEY" \
  "https://api.wave.inc/v1/events?type=error&limit=10" | jq .
View expected output
{
  "data": [
    {
      "id": "evt_123",
      "type": "stream.error",
      "error_code": "STREAM_002",
      "created_at": "2024-01-15T10:30:00Z"
    }
  ]
}

Test Webhook Endpoint

Send a test webhook to your endpoint

curl -X POST -H "Authorization: Bearer $WAVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://api.example.com/webhooks"}' \
  https://api.wave.inc/v1/webhooks/test | jq .
View expected output
{
  "success": true,
  "response_time_ms": 245,
  "status_code": 200
}

Debug Stream Connection

Test stream connectivity and protocols

wave-cli stream debug --stream-id str_abc123
View expected output
Stream ID: str_abc123
Protocol: RTMP
Ingest: rtmp://ingest.wave.inc/live
Status: CONNECTED
Bitrate: 4500 kbps
Codec: H.264/AAC
Latency: 850ms

Troubleshooting Common Scenarios

Debugging Best Practices

1Always Log Request IDs

Every error includes a unique request_id for tracing.

logger.error('API error', { request_id: error.request_id })

2Validate Before Sending

Use TypeScript types or JSON Schema validation client-side.

const validated = StreamSchema.parse(streamData)

3Monitor Error Rates

Set alerts for error rates above 5% or specific codes like 429.

Sentry, Datadog, Dash0, or CloudWatch

4Use Idempotency Keys

Include Idempotency-Key for safe retries.

Idempotency-Key: uuid-v4-generated-client

5Implement Circuit Breakers

Fail fast when services are unavailable to prevent cascade failures.

Open after 5 failures, half-open after 30s

6Check Status Page

Before debugging extensively, check for known incidents.

status.wave.inc - Subscribe for updates

Getting Help

Community

Response: 24-48 hours

Channels:

Documentation
Community Forum
GitHub Issues

Features:

  • Self-service troubleshooting
  • Community answers
  • Public issue tracking

Professional

Response: 4-8 hours

Channels:

Email Support
Chat Support
Phone (business hours)

Features:

  • Direct engineer access
  • Priority issue handling
  • Implementation guidance

Enterprise

Response: < 1 hour (P1)

Channels:

Dedicated Slack Channel
24/7 Phone
Video Calls

Features:

  • Named support engineer
  • Proactive monitoring
  • Custom SLA
  • Root cause analysis

When Contacting Support

1

Include request_id

From error response or logs

2

Describe expected vs actual

What should happen vs what did

3

Share minimal reproduction

Curl command or code snippet

WAVE - Enterprise Live Streaming Platform