VectifyAI/PageIndex · error · PageIndexAPIError

messages requires anthropic >= 0.108.0 (the tool runner with

Error message

messages requires anthropic >= 0.108.0 (the tool runner with ToolError) — pip install -U anthropic.

What it means

pageindex's messages engine reads the conversation back through anthropic's beta_tool runner and its ToolError class, which only exist in anthropic >= 0.108.0. After confirming the SDK is importable, _require_anthropic() checks for these symbols and rejects older releases. An outdated SDK would otherwise silently lose tool turns.

Source

Thrown at pageindex/local_chat.py:880

    return _stream_sync(agen)


# ── Anthropic engine (messages) ──

def _require_anthropic() -> None:
    try:
        import anthropic  # noqa: F401
    except ImportError as exc:
        raise PageIndexAPIError(
            "messages drives your own chat model and requires the "
            "Anthropic SDK — "
            "pip install anthropic (or pip install 'pageindex[anthropic]')."
        ) from exc
    try:
        from anthropic import beta_tool  # noqa: F401
        from anthropic.lib.tools import ToolError  # noqa: F401
    except ImportError as exc:
        raise PageIndexAPIError(
            "messages requires anthropic >= 0.108.0 (the tool "
            "runner with ToolError) — pip install -U anthropic."
        ) from exc


_ANTHROPIC_CLIENTS: dict = {}  # backend key -> client, kept open for reuse


def _anthropic_client(backend=None):
    """The backend client — the seam tests replace with a fake transport.
    One client per backend: each construction pays ~45 ms of SSL-context
    build and a cold connection pool. A backend whose values defeat
    hashing constructs per call, as before."""
    import anthropic
    kwargs = _sdk_backend(backend)
    try:
        key = tuple(sorted(
            (k, tuple(sorted(v.items())) if isinstance(v, dict) else v)

View on GitHub (pinned to afb5e11976)

Solutions

  1. pip install -U anthropic to get >= 0.108.0
  2. Pin a floor in your dependency file: anthropic>=0.108.0
  3. Confirm the version: python -c "import anthropic; print(anthropic.__version__)"

Example fix

# before
# requirements.txt
anthropic==0.95.0
# after
anthropic>=0.108.0
Defensive patterns

Strategy: validation

Validate before calling

import anthropic
from packaging.version import Version
assert Version(anthropic.__version__) >= Version("0.108.0"), "upgrade: pip install -U anthropic"

Try / catch

try:
    client.messages("hi")
except PageIndexAPIError as e:
    if "anthropic >= 0.108.0" in str(e):
        subprocess.check_call([sys.executable, "-m", "pip", "install", "-U", "anthropic"])
    raise

Prevention

When it happens

Trigger: Calling client.messages(...) with an installed anthropic version older than 0.108.0, where `from anthropic import beta_tool` or `from anthropic.lib.tools import ToolError` raises ImportError.

Common situations: A requirements.txt pinned to an old anthropic version; a long-lived virtualenv upgraded for pageindex but not the SDK; a platform (Heroku, Lambda layer) shipping a stale anthropic build.

Related errors


AI-assisted analysis of VectifyAI/PageIndex@afb5e11976 (2026-08-27). Data as JSON: /api/errors/ed9e0c7fa9a6c230. Report an issue: GitHub.