{"record":{"id":"b27e62cd88c4b4fe","repo":"VectifyAI/PageIndex","slug":"chat-declares-mode-cloud-but-carries-keys","errorCode":null,"errorMessage":"chat declares mode \"cloud\" but carries ({keys}) — the managed chat selects its own model. Drop the mode, or the keys.","messagePattern":"chat declares mode \"cloud\" but carries \\((.+?)\\) — the managed chat selects its own model\\. Drop the mode, or the keys\\.","errorType":"validation","errorClass":"PageIndexAPIError","httpStatus":null,"severity":"error","filePath":"pageindex/client.py","lineNumber":212,"sourceCode":"            return \"own\", {\"chat_model\": chat}\n        raise PageIndexAPIError(\n            \"chat is an empty string — pass a model name, or \"\n            '\"cloud\" for the managed chat.')\n    if isinstance(chat, Mapping):\n        # None-valued keys mean \"absent\", exactly like the flat arguments.\n        conf = {name: value for name, value in chat.items()\n                if value is not None}\n        declared = _declared_mode(conf.pop(\"mode\", None), \"chat\")\n        unknown = set(conf) - {\"model\", \"backend\"}\n        if (not conf and declared is None) or unknown:\n            raise PageIndexAPIError(\n                (\"chat is an empty dict\" if not conf else\n                 f\"Unknown chat keys ({', '.join(sorted(unknown))})\")\n                + ' — chat takes \"model\" and \"backend\" (your own model), '\n                'or {\"mode\": \"cloud\"} / \"cloud\" for the managed chat.')\n        if declared == \"cloud\":\n            if conf:\n                raise PageIndexAPIError(\n                    'chat declares mode \"cloud\" but carries '\n                    f\"({', '.join(sorted(conf))}) — the managed chat \"\n                    \"selects its own model. Drop the mode, or the keys.\")\n            return \"managed\", {}\n        mapped = {\"chat_model\": conf.get(\"model\"),\n                  \"chat_backend\": conf.get(\"backend\")}\n        return \"own\", {name: value for name, value in mapped.items()\n                       if value is not None}\n    raise PageIndexAPIError(\"chat must be a string or a dict.\")\n\n\nclass PageIndexClient:\n    \"\"\"\n    Python SDK client for PageIndex.\n\n    Two independent sides, each locally run or cloud-managed:\n\n    - **index** — where documents live. With an ``api_key`` they live in","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/VectifyAI/PageIndex/blob/afb5e119766630af6014b04fe8b53357527bc05e/pageindex/client.py#L194-L230","documentation":"The chat dict declared {\"mode\": \"cloud\"} (managed chat) but also carried \"model\"/\"backend\" keys. The managed cloud chat picks its own model, so user-supplied model settings contradict the declaration; the SDK refuses to guess which wins.","triggerScenarios":"PageIndexClient(chat={\"mode\": \"cloud\", \"model\": \"gpt-4o-mini\"}) or chat={\"mode\": \"cloud\", \"backend\": {...}}).","commonSituations":"Starting from an own-model config and adding mode: cloud to \"switch\" without removing the old keys; config templates that pre-fill a model alongside a mode field.","solutions":["For the managed chat, keep only {\"mode\": \"cloud\"}","To use your own model, drop the \"mode\" key and keep \"model\"/\"backend\""],"exampleFix":"# before\nPageIndexClient(chat={\"mode\": \"cloud\", \"model\": \"gpt-4o-mini\"})\n# after\nPageIndexClient(chat={\"mode\": \"cloud\"})","handlingStrategy":"validation","validationCode":"if chat.get(\"mode\") == \"cloud\":\n    chat = {k: v for k, v in chat.items() if k == \"mode\"}  # strip model/backend","typeGuard":"def cloud_mode_is_clean(d: dict) -> bool:\n    return not (d.get(\"mode\") == \"cloud\" and set(d) - {\"mode\"})","tryCatchPattern":null,"preventionTips":["Treat mode: cloud as exclusive — never combine it with model/backend in templates","Write a config normalizer that strips own-model keys when mode is cloud"],"tags":["config","chat","conflicting-options"],"backgroundTag":"conflicting-config-options","analyzedSha":"afb5e119766630af6014b04fe8b53357527bc05e","analyzedAt":"2026-08-27T11:20:48.519Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}