---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/llm/transformers_js/helpers/functions/isGpuOutOfMemoryError.md
---

# Function: isGpuOutOfMemoryError()

```ts
function isGpuOutOfMemoryError(message: string): boolean;
```

Defined in: [src/batteries/llm/chat\_common/gpu\_budget.ts:62](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/llm/chat_common/gpu_budget.ts#L62)

Detect the WebGPU "out of memory / failed to allocate" family of errors from a message string.

## Parameters

| Parameter | Type     | Description                                                          |
| --------- | -------- | -------------------------------------------------------------------- |
| `message` | `string` | The error message (or any stringifiable value's `String(...)` form). |

## Returns

`boolean`

`true` when the message matches a known GPU-exhaustion signature.

## Remarks

ORT-web surfaces GPU exhaustion through several non-obvious signatures depending on where the
allocation failed (buffer mapping, device loss, unaligned-access fallback, Dawn validation). This
matcher is the single source of truth both on-device batteries use to translate a raw provider throw
into a typed, catchable `E_*_GPU_OUT_OF_MEMORY`. Substring/case-insensitive; intentionally broad on
the well-known phrases but anchored enough not to swallow unrelated errors. Verified against the
signatures observed in the flagship agent's WebGPU OOM repro (Apple Metal, 4 GiB budget).
