Skip to main content
Early Beta — The Web SDK is in early beta. APIs may change between releases.

Overview

The RunAnywhere Web SDK provides structured error handling through SDKError 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 serves index.html for unknown paths, .wasm file requests will return HTML instead of the binary. The WASM compiler receives HTML bytes and throws:
The bytes 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”

Calling VideoCapture.captureFrame() before the video stream is fully initialized causes:
Fix: Wait for the video element’s loadedmetadata event or check videoElement.videoWidth > 0 before capturing. See VLM camera readiness.

VLM Worker “non-JavaScript MIME type”

The VLM Web Worker URL is resolving to your SPA’s index.html. Fix:
  1. Use COEP: credentialless (not require-corp)
  2. Ensure .js files are served as static assets before the catch-all route
  3. Add worker: { format: 'es' } to your Vite config

Retry Logic

User-Friendly Messages

React Error Hook

useSDKError.ts

Logging Errors

Configuration

SDK configuration

Best Practices

Optimization tips