Early Beta — The Web SDK is in early beta. APIs may change between releases.
Overview
The RunAnywhere Web SDK provides structured error handling throughSDKError with specific error codes. This guide covers error types, handling patterns, and recovery strategies.
SDKError Structure
Checking for SDK Errors
Error Codes
Initialization Errors
Model Errors
Generation Errors
Download Errors
Storage Errors
WASM Errors
Static Factory Methods
SDKError provides convenient factory methods:
Handling Patterns
Basic Error Handling
WASM Memory Crash Handling
VLM inference can occasionally trigger WASM memory errors. These are recoverable:WASM Binary Served as HTML (Production)
In production, if your server has a SPA catch-all route that servesindex.html for unknown paths, .wasm file requests will return HTML instead of the binary. The WASM compiler receives HTML bytes and throws:
3c 21 44 4f decode to <!DO — the start of an HTML document. Fix: ensure static asset serving (with correct MIME types) comes before SPA catch-all routing. See Installation troubleshooting.
Camera “source width is 0”
CallingVideoCapture.captureFrame() before the video stream is fully initialized causes:
loadedmetadata event or check videoElement.videoWidth > 0 before capturing. See VLM camera readiness.
VLM Worker “non-JavaScript MIME type”
index.html. Fix:
- Use
COEP: credentialless(notrequire-corp) - Ensure
.jsfiles are served as static assets before the catch-all route - Add
worker: { format: 'es' }to your Vite config
Retry Logic
User-Friendly Messages
React Error Hook
useSDKError.ts
Logging Errors
Related
Configuration
SDK configuration
Best Practices
Optimization tips