{"record":{"id":"0234e8a93b61b961","repo":"microsoft/semantic-kernel","slug":"dimensionality-of-default-dimensionality-exceeds","errorCode":null,"errorMessage":"Dimensionality of {default_dimensionality} exceeds the maximum allowed value of {MAX_DIMENSIONALITY}.","messagePattern":"Dimensionality of (.+?) exceeds the maximum allowed value of (.+?)\\.","errorType":"exception","errorClass":"MemoryConnectorInitializationError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/memory_stores/pinecone/pinecone_memory_store.py","lineNumber":67,"sourceCode":"\n    def __init__(\n        self,\n        api_key: str,\n        default_dimensionality: int,\n        env_file_path: str | None = None,\n        env_file_encoding: str | None = None,\n    ) -> None:\n        \"\"\"Initializes a new instance of the PineconeMemoryStore class.\n\n        Args:\n            api_key (str): The Pinecone API key.\n            default_dimensionality (int): The default dimensionality to use for new collections.\n            env_file_path (str | None): Use the environment settings file as a fallback\n                to environment variables. (Optional)\n            env_file_encoding (str | None): The encoding of the environment settings file. (Optional)\n        \"\"\"\n        if default_dimensionality > MAX_DIMENSIONALITY:\n            raise MemoryConnectorInitializationError(\n                f\"Dimensionality of {default_dimensionality} exceeds the maximum allowed value of {MAX_DIMENSIONALITY}.\"\n            )\n        try:\n            pinecone_settings = PineconeSettings(\n                api_key=api_key,\n                env_file_path=env_file_path,\n                env_file_encoding=env_file_encoding,\n            )\n        except ValidationError as ex:\n            raise MemoryConnectorInitializationError(\"Failed to create Pinecone settings.\", ex) from ex\n\n        self._default_dimensionality = default_dimensionality\n\n        self.pinecone = Pinecone(api_key=pinecone_settings.api_key.get_secret_value())\n        self.collection_names_cache = set()\n\n    async def create_collection(\n        self,","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/memory_stores/pinecone/pinecone_memory_store.py#L49-L85","documentation":"Raised in PineconeMemoryStore.__init__ when default_dimensionality exceeds MAX_DIMENSIONALITY (20000, the Pinecone platform limit). It is a MemoryConnectorInitializationError thrown synchronously during construction, before any Pinecone client is created. The constant is sourced from Pinecone's published known limitations.","triggerScenarios":"Constructing PineconeMemoryStore(api_key=..., default_dimensionality=N) with N > 20000. Typically a wrong embedding model dimension passed by mistake, or a value computed from config without bounds checking.","commonSituations":"Switching to a large-dimension embedding model and passing its dimension verbatim; reading dimensionality from an env var as a wrong type or inflated value; copy-paste of an embedding size from a different provider.","solutions":["Reduce default_dimensionality to <= 20000 by using a compatible embedding model.","Validate the dimensionality value against MAX_DIMENSIONALITY before constructing the store.","Confirm the embedding model's actual vector size in its spec and pass exactly that.","Migrate to the non-deprecated PineconeStore + Collection API."],"exampleFix":"// before\nstore = PineconeMemoryStore(api_key=key, default_dimensionality=50000)\n\n// after\nfrom semantic_kernel.connectors.memory_stores.pinecone.pinecone_memory_store import MAX_DIMENSIONALITY\nassert dim <= MAX_DIMENSIONALITY, f\"dim {dim} exceeds {MAX_DIMENSIONALITY}\"\nstore = PineconeMemoryStore(api_key=key, default_dimensionality=dim)","handlingStrategy":"validation","validationCode":"from semantic_kernel.connectors.memory_stores.pinecone.pinecone_memory_store import MAX_DIMENSIONALITY\nif default_dimensionality > MAX_DIMENSIONALITY:\n    raise ValueError(f\"dimensionality {default_dimensionality} > max {MAX_DIMENSIONALITY}\")\nstore = PineconeMemoryStore(api_key=key, default_dimensionality=default_dimensionality)","typeGuard":"def is_valid_dimensionality(d: int) -> bool:\n    return isinstance(d, int) and 0 < d <= 20000","tryCatchPattern":"from semantic_kernel.exceptions.memory_connector_exceptions import MemoryConnectorInitializationError\ntry:\n    store = PineconeMemoryStore(api_key=key, default_dimensionality=dim)\nexcept MemoryConnectorInitializationError as e:\n    raise SystemExit(f\"bad dimensionality config: {e}\") from e","preventionTips":["Source dimensionality from the embedding model spec, not a guessed number.","Clamp config-driven dimensionality at the boundary.","Unit-test store construction with the real model dimension."],"tags":["pinecone","memory-store","deprecated","configuration","dimensionality","init"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}