{"record":{"id":"31ea15197928d2e1","repo":"openai/openai-python","slug":"pagination-is-only-supported-with-mappings","errorCode":null,"errorMessage":"Pagination is only supported with mappings","messagePattern":"Pagination is only supported with mappings","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"src/openai/_base_client.py","lineNumber":236,"sourceCode":"\n    def _info_to_options(self, info: PageInfo) -> FinalRequestOptions:\n        options = model_copy(self._options)\n        options._strip_raw_response_header()\n\n        if not isinstance(info.params, NotGiven):\n            options.params = {**options.params, **info.params}\n            return options\n\n        if not isinstance(info.url, NotGiven):\n            params = self._params_from_url(info.url)\n            url = info.url.copy_with(params=params)\n            options.params = dict(url.params)\n            options.url = str(url)\n            return options\n\n        if not isinstance(info.json, NotGiven):\n            if not is_mapping(info.json):\n                raise TypeError(\"Pagination is only supported with mappings\")\n\n            if not options.json_data:\n                options.json_data = {**info.json}\n            else:\n                if not is_mapping(options.json_data):\n                    raise TypeError(\"Pagination is only supported with mappings\")\n\n                options.json_data = {**options.json_data, **info.json}\n            return options\n\n        raise ValueError(\"Unexpected PageInfo state\")\n\n\nclass BaseSyncPage(BasePage[_T], Generic[_T]):\n    _client: SyncAPIClient = pydantic.PrivateAttr()\n\n    def _set_private_attributes(\n        self,","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/_base_client.py#L218-L254","documentation":"The OpenAI Python SDK raises this ValueError when client.vector_stores.file_batches.cancel() (sync) is called with a falsy vector_store_id (empty string, None). It is a client-side guard added before the HTTP request so an invalid path parameter fails fast instead of producing a malformed URL or a confusing 404 from the API.","triggerScenarios":"Calling cancel(vector_store_id='', batch_id='vsfb_...') or passing a variable that was never assigned (defaults to '' or None) on the synchronous VectorStoreFileBatches resource.","commonSituations":"Loading IDs from config/env vars that are unset, using a store ID from a deleted vector store, refactoring that dropped the variable assignment, or passing a create() response field name incorrectly (e.g. mistaking file_batch.id for vector_store.id).","solutions":["Check the variable holding vector_store_id right before the call; assign the real 'vs_...' ID from the vector store you created or retrieved.","If the ID comes from environment/config, verify it is set (os.environ.get('VECTOR_STORE_ID')) and fail loudly at startup if missing.","Confirm you are using the IDs in the right order: cancel(vector_store_id='vs_...', batch_id='vsfb_...').","If constructing IDs dynamically, log or assert they are non-empty strings before invoking the SDK."],"exampleFix":"// before\nbatch = client.vector_stores.file_batches.cancel(vector_store_id=store_id, batch_id=batch_id)  # store_id == ''\n\n# after\nif not store_id:\n    raise ValueError(\"vector_store_id is missing; create or retrieve the vector store first\")\nbatch = client.vector_stores.file_batches.cancel(vector_store_id=store_id, batch_id=batch_id)","handlingStrategy":"validation","validationCode":"if not isinstance(vector_store_id, str) or not vector_store_id.strip():\n    raise ValueError(\"vector_store_id must be a non-empty string\")\nclient.vector_stores.file_batches.cancel(vector_store_id=vector_store_id, batch_id=batch_id)","typeGuard":"def is_valid_vector_store_id(v: object) -> bool:\n    return isinstance(v, str) and bool(v.strip()) and v.startswith(\"vs_\")","tryCatchPattern":null,"preventionTips":["Always pass IDs as keyword arguments to avoid positional mix-ups.","Persist vector store IDs at creation time instead of reconstructing them later."],"tags":["openai","vector-stores","file-batches","validation","valueerror","python"],"backgroundTag":"empty-required-parameter","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}