{"record":{"id":"7538159e26fdaafa","repo":"VectifyAI/PageIndex","slug":"index-and-the-flat-index-side-arguments-args","errorCode":null,"errorMessage":"index= and the flat index-side arguments ({args}) are two spellings of the same thing — use one or the other.","messagePattern":"index= and the flat index-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":382,"sourceCode":"             (\"index_model\", index_model),\n             (\"summary_model\", summary_model),\n             (\"index_backend\", index_backend),\n             (\"storage_path\", storage_path), (\"model\", model))\n            if value is not None}\n        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(","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/VectifyAI/PageIndex/blob/afb5e119766630af6014b04fe8b53357527bc05e/pageindex/client.py#L364-L400","documentation":"The index-side configuration was spelled twice: once via the index= slot dict and once via flat arguments like index_model=/retrieve_model=/index_backend=. The SDK forbids the duplication because there is no rule for which spelling wins.","triggerScenarios":"PageIndexClient(index={\"model\": \"m\"}, index_model=\"m2\") or index={\"backend\": {...}, retrieve_model=\"r\").","commonSituations":"Refactoring code from flat kwargs to slot dicts without removing the old arguments; copying examples that use different styles.","solutions":["Keep one spelling: either the index= dict or the flat index_model=/retrieve_model=/index_backend= arguments","Delete the duplicated flat arguments from the call"],"exampleFix":"# before\nPageIndexClient(index={\"model\": \"m\"}, retrieve_model=\"r\")\n# after\nPageIndexClient(index={\"model\": \"m\", \"retrieve_model\": \"r\"})","handlingStrategy":"validation","validationCode":"index_flat_used = any(v is not None for v in (index_model, retrieve_model, index_backend))\nassert not (index is not None and index_flat_used)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Adopt one style per codebase (slot dicts or flat kwargs) and lint for the other","When migrating configs, delete the old spelling in the same commit"],"tags":["config","index","duplicate-arguments"],"backgroundTag":"duplicate-config-arguments","analyzedSha":"afb5e119766630af6014b04fe8b53357527bc05e","analyzedAt":"2026-08-27T11:20:48.519Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}