Variable: E_LLM_GPU_OUT_OF_MEMORY
const E_LLM_GPU_OUT_OF_MEMORY: CreatedException<[string, string]>;Defined in: src/batteries/llm/chat_common/exceptions.ts:33
Raised when the WebGPU execution provider exhausts the device's GPU memory budget during generation.
Remarks
The ADK stance is surface, don't impose — rather than silently capping the caller's context window, the on-device batteries translate ORT-web's cryptic, location-dependent GPU-exhaustion throws (Failed to allocate memory for buffer mapping, device is lost, operation does not support unaligned accesses, …) into THIS single typed error, so an application can catch it structurally — if (isInstanceOf(err, 'E_LLM_GPU_OUT_OF_MEMORY')) … — instead of string-matching runtime internals, and react however it wants (warn + retry with a smaller window, recycle() the adapter to flush the WebGPU buffer freelist, switch to a smaller model, …).
Non-fatal: the adapter surfaces it via ctx.nack(...) (not a throw), exactly like the generic stream error, so the turn ends cleanly and the application can offer a retry. The matcher behind the translation is isGpuOutOfMemoryError in ./gpu_budget. Printf args: [providerMessage, contextWindowSummary] — the raw provider message and a short budget/window note the application can show the user verbatim.