Skip to main content
Everything the SDK throws is an SDKException, wrapping a proto-backed error so the same code and category cross every language binding.

Codes worth handling

unsupportedCapability

You will also meet it on win32-arm64, where only QHexRT loads and anything needing llama.cpp, ONNX, or Sherpa reports unavailable rather than failing obscurely at first use.

Errors in streams

Preflight failures throw from the call. A failure during generation arrives as a failed event:
Breaking out yields a cancelled terminal event, which is not a failure. This is the same shape as the Web SDK and the opposite of Swift, Kotlin, Flutter, and React Native, where in-flight failures are thrown into the consumer.

Errors across the context bridge

An exception thrown in the main process does not arrive in the renderer as an SDKException. Structured clone drops the prototype, so instanceof fails there. Send the code and message explicitly rather than the error object:

Failures that are not the SDK

The second one is worth remembering, because the error names the model rather than the packaging fault that caused it.

Reporting

Rethrow what you did not recognise.