---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/context/exceptions/variables/E_CONTEXT_RESOLVER_MISSING.md
description: >-
  Thrown when a context-management battery function is called without a REQUIRED
  injected resolver (`estimateTokens`, or — for Compact's `summarize` seam — the
  model-call function).
---

# Variable: E\_CONTEXT\_RESOLVER\_MISSING

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

Defined in: [src/batteries/context/exceptions.ts:54](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/context/exceptions.ts#L54)

Thrown when a context-management battery function is called without a REQUIRED injected resolver
(`estimateTokens`, or — for Compact's `summarize` seam — the model-call function).

## Remarks

Both `@nhtio/adk/batteries/context/thrift` and `@nhtio/adk/batteries/context/compact` ship with no
bundled tokenizer and (for Compact) no bundled model transport — every capability they cannot
perform themselves is an INJECTED function the caller must supply. Omitting one is a caller
programming error (a wiring mistake, not a runtime condition to recover from): rather than let the
omission surface later as a confusing `undefined is not a function` deep inside the algorithm, every
entry point checks eagerly and throws this, naming both the missing option and the function that
needed it, so the fix is obvious at the call site. Fatal — construct the missing resolver and retry;
there is no degrade-and-continue path, because a battery with no way to measure tokens (or, for
Compact, no way to call a model) cannot make progress at all.

Printf args: `[functionName, missingOption]` — e.g. `['subtractToFit', 'estimateTokens']` or
`['summariseTurns', 'summarize']`.

## Example

```ts
import { isInstanceOf } from "@nhtio/adk";

try {
  subtractToFit(ws, contextWindow, relevantToolNames, {} as never);
} catch (err) {
  if (isInstanceOf(err, "E_CONTEXT_RESOLVER_MISSING")) {
    // err.message: "subtractToFit: options.estimateTokens is required — this context-management
    // battery ships with no bundled tokenizer/model transport of its own."
  }
}
```
