{"record":{"id":"2f7701d5efa1f20e","repo":"VectifyAI/PageIndex","slug":"chat-and-the-flat-chat-side-arguments-args-ar","errorCode":null,"errorMessage":"chat= and the flat chat-side arguments ({args}) are two spellings of the same thing — use one or the other.","messagePattern":"chat= and the flat chat-side arguments \\((.+?)\\) are two spellings of the same thing — use one or the other\\.","errorType":"validation","errorClass":"PageIndexAPIError","httpStatus":null,"severity":"error","filePath":"pageindex/client.py","lineNumber":387,"sourceCode":"        chat_flat: dict[str, Any] = {\n            name: value for name, value in\n            ((\"chat_model\", chat_model),\n             (\"retrieve_model\", retrieve_model),\n             (\"chat_backend\", chat_backend), (\"model\", model))\n            if value is not None}\n        if model is not None and (index is not None or chat is not None):\n            raise PageIndexAPIError(\n                \"model= sets both roles at once, so no slot can absorb \"\n                'it — name the model inside the slot ({\"model\": ...}) '\n                \"and use index_model= / chat_model= for a side written \"\n                \"flat.\")\n        if index is not None and index_flat:\n            raise PageIndexAPIError(\n                \"index= and the flat index-side arguments \"\n                f\"({', '.join(sorted(index_flat))}) are two spellings of \"\n                \"the same thing — use one or the other.\")\n        if chat is not None and chat_flat:\n            raise PageIndexAPIError(\n                \"chat= and the flat chat-side arguments \"\n                f\"({', '.join(sorted(chat_flat))}) are two spellings of \"\n                \"the same thing — use one or the other.\")\n        # ``mode=`` is a cross-check, not a spelling: it combines with\n        # either spelling of the index side and must agree with it. The\n        # pinned classes declare the side by class; their errors name the\n        # class, never a mode= the user did not write.\n        declared = _declared_mode(mode, \"client\") or self._pin\n        pinned = type(self).__name__ if self._pin else None\n        if index is not None:\n            cloud_key, index_conf = _resolve_index_slot(index)\n            if declared == \"local\" and cloud_key is not None:\n                raise PageIndexAPIError(\n                    f\"{pinned} pins local documents — that index= selects \"\n                    \"cloud documents. Drop it, or use PageIndexCloudClient.\"\n                    if pinned else\n                    'mode=\"local\" disagrees with index= — that index '\n                    \"selects cloud documents. Drop one of them.\")","sourceCodeStart":369,"sourceCodeEnd":405,"githubUrl":"https://github.com/VectifyAI/PageIndex/blob/afb5e119766630af6014b04fe8b53357527bc05e/pageindex/client.py#L369-L405","documentation":"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.","triggerScenarios":"PageIndexClient(chat=\"gpt-4o-mini\", chat_backend={...}) or chat={\"mode\": \"cloud\"} together with chat_model=\"m\").","commonSituations":"Adding chat_backend for a custom runner while an old chat= string is still in the call; config migration between the two spellings.","solutions":["Keep one spelling: either chat= (string or dict) or the flat chat_model=/chat_backend= arguments","Merge the model and backend into one place"],"exampleFix":"# before\nPageIndexClient(chat=\"gpt-4o-mini\", chat_backend={\"provider\": \"litellm\"})\n# after\nPageIndexClient(chat={\"model\": \"gpt-4o-mini\", \"backend\": {\"provider\": \"litellm\"}})","handlingStrategy":"validation","validationCode":"chat_flat_used = any(v is not None for v in (chat_model, chat_backend))\nassert not (chat is not None and chat_flat_used)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Choose either chat= or chat_model=/chat_backend=, never both","Centralize client construction in one factory function to enforce the convention"],"tags":["config","chat","duplicate-arguments"],"backgroundTag":"duplicate-config-arguments","analyzedSha":"afb5e119766630af6014b04fe8b53357527bc05e","analyzedAt":"2026-08-27T11:20:48.519Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}