VectifyAI/PageIndex · error · PageIndexAPIError

chat= and the flat chat-side arguments ({args}) are two spel

Error message

chat= and the flat chat-side arguments ({args}) are two spellings of the same thing — use one or the other.

What it means

The chat-side configuration was spelled twice: via the chat= slot and via flat chat_model=/chat_backend= arguments. As with the index side, the SDK rejects the ambiguity rather than picking a winner.

Source

Thrown at pageindex/client.py:387

        chat_flat: dict[str, Any] = {
            name: value for name, value in
            (("chat_model", chat_model),
             ("retrieve_model", retrieve_model),
             ("chat_backend", chat_backend), ("model", model))
            if value is not None}
        if model is not None and (index is not None or chat is not None):
            raise PageIndexAPIError(
                "model= sets both roles at once, so no slot can absorb "
                'it — name the model inside the slot ({"model": ...}) '
                "and use index_model= / chat_model= for a side written "
                "flat.")
        if index is not None and index_flat:
            raise PageIndexAPIError(
                "index= and the flat index-side arguments "
                f"({', '.join(sorted(index_flat))}) are two spellings of "
                "the same thing — use one or the other.")
        if chat is not None and chat_flat:
            raise PageIndexAPIError(
                "chat= and the flat chat-side arguments "
                f"({', '.join(sorted(chat_flat))}) are two spellings of "
                "the same thing — use one or the other.")
        # ``mode=`` is a cross-check, not a spelling: it combines with
        # either spelling of the index side and must agree with it. The
        # pinned classes declare the side by class; their errors name the
        # class, never a mode= the user did not write.
        declared = _declared_mode(mode, "client") or self._pin
        pinned = type(self).__name__ if self._pin else None
        if index is not None:
            cloud_key, index_conf = _resolve_index_slot(index)
            if declared == "local" and cloud_key is not None:
                raise PageIndexAPIError(
                    f"{pinned} pins local documents — that index= selects "
                    "cloud documents. Drop it, or use PageIndexCloudClient."
                    if pinned else
                    'mode="local" disagrees with index= — that index '
                    "selects cloud documents. Drop one of them.")

View on GitHub (pinned to afb5e11976)

Solutions

  1. Keep one spelling: either chat= (string or dict) or the flat chat_model=/chat_backend= arguments
  2. Merge the model and backend into one place

Example fix

# before
PageIndexClient(chat="gpt-4o-mini", chat_backend={"provider": "litellm"})
# after
PageIndexClient(chat={"model": "gpt-4o-mini", "backend": {"provider": "litellm"}})
Defensive patterns

Strategy: validation

Validate before calling

chat_flat_used = any(v is not None for v in (chat_model, chat_backend))
assert not (chat is not None and chat_flat_used)

Prevention

When it happens

Trigger: PageIndexClient(chat="gpt-4o-mini", chat_backend={...}) or chat={"mode": "cloud"} together with chat_model="m").

Common situations: Adding chat_backend for a custom runner while an old chat= string is still in the call; config migration between the two spellings.

Related errors


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