---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/llm/ollama/exceptions/variables/E_OLLAMA_CONTEXT_OVERFLOW.md
description: >-
  Thrown when the total token weight of the resolved request exceeds
  `contextWindow`. Only raised when `tokenEncoding` is non-null. Carries `{
  total, contextWindow, tokenEncoding, perBucket }` in the message so middleware
  can target shedding.
---

# Variable: E\_OLLAMA\_CONTEXT\_OVERFLOW

```ts
const E_OLLAMA_CONTEXT_OVERFLOW: CreatedException<
  [number, number, string, string]
>;
```

Defined in: [batteries/llm/ollama/exceptions.ts:48](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/batteries/llm/ollama/exceptions.ts#L48)

Thrown when the total token weight of the resolved request exceeds `contextWindow`. Only raised
when `tokenEncoding` is non-null. Carries `{ total, contextWindow, tokenEncoding, perBucket }` in
the message so middleware can target shedding.

## Remarks

This is the ADK-side token-budget guard and is independent of Ollama's server-side `num_ctx`
(KV-cache size) runtime option; the adapter does not auto-sync the two.
