> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ai-coustics.com/llms.txt
> Use this file to discover all available pages before exploring further.

# WebAssembly errors

> Handle initialization, model, parameter and processing failures.

**Version:** `@ai-coustics/aic-sdk-wasm` 0.23.0, Core SDK 0.23.0. [API index](/reference/sdk/api/wasm/index) · [WebAssembly quickstart](/reference/sdk/language-bindings/wasm).

The binding throws JavaScript `Error` or `RangeError` objects. It does not export SDK exception classes, an error-code enum or a structured `code` property. TypeScript signatures do not list thrown exceptions. Catch errors around construction, initialization, model loading, token renewal and processing, and release already-created handles in `finally`.

| Failure                                               | JavaScript error | Recovery                                                                                         |
| ----------------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------ |
| Processor or VAD parameter outside its accepted range | `RangeError`     | Correct the parameter before processing again.                                                   |
| Analysis-window range error propagated by the core    | `RangeError`     | Check model compatibility; this binding exposes no window-length setting.                        |
| Processor or collector not initialized                | `Error`          | Successfully initialize before passing audio.                                                    |
| Unsupported audio configuration                       | `Error`          | Use a supported sample rate and valid block size.                                                |
| Audio block does not match initialized configuration  | `Error`          | Supply the required number of mono samples.                                                      |
| Processing disallowed                                 | `Error`          | Resolve session authorization and network requirements; do not retry in a tight processing loop. |
| Invalid, unsupported or expired credential            | `Error`          | Obtain a valid credential through your backend.                                                  |
| Unsupported token update                              | `Error`          | Ensure the original and replacement credentials are both JWT-form credentials.                   |
| Model type unsupported by the selected class          | `Error`          | Match enhancement, VAD and analysis models to their respective classes.                          |
| Model parsing, allocation or runtime creation failure | `Error`          | Check model bytes and runtime compatibility.                                                     |
| Internal processing failure                           | `Error`          | Stop using the stream and retain the error message for diagnosis.                                |

The delegated core also defines voiceprint errors for other interfaces. This package exposes no enrollment or voiceprint methods. Binding misuse, invalid JavaScript types, initialization failures and access after `free()` can produce JavaScript or WebAssembly errors outside the SDK mapping; do not depend on their exact text or class.

A failed `updateBearerToken` preserves the previous token. A successful call checks local format, not backend acceptance. A failed initialization requires successful reinitialization before submitting more audio. A failed enhancement call does not guarantee the input array is unchanged.

```javascript theme={null}
try {
  context.setParameter(ProcessorParameter.EnhancementLevel, requestedLevel);
} catch (error) {
  if (error instanceof RangeError) {
    console.error("Enhancement level must be between 0 and 1.");
  } else {
    throw error;
  }
}
```

This fragment assumes a live `ProcessorContext` named `context`, a numeric `requestedLevel` and `ProcessorParameter` imported from the package. See [enhancement](/reference/sdk/api/wasm/enhancement) for the full control API and [lifecycle](/reference/sdk/api/wasm/initialization#ownership-and-cleanup) for cleanup.
