{"record":{"id":"f767e27013481f81","repo":"mem0ai/mem0","slug":"either-api-key-or-client-must-be-provided-or","errorCode":null,"errorMessage":"Either 'api_key' or 'client' must be provided, or PINECONE_API_KEY environment variable must be set.","messagePattern":"Either 'api_key' or 'client' must be provided, or PINECONE_API_KEY environment variable must be set\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mem0/configs/vector_stores/pinecone.py","lineNumber":28,"sourceCode":"    collection_name: str = Field(\"mem0\", description=\"Name of the index/collection\")\n    embedding_model_dims: int = Field(1536, description=\"Dimensions of the embedding model\")\n    client: Optional[Any] = Field(None, description=\"Existing Pinecone client instance\")\n    api_key: Optional[str] = Field(None, description=\"API key for Pinecone\")\n    environment: Optional[str] = Field(None, description=\"Pinecone environment\")\n    serverless_config: Optional[Dict[str, Any]] = Field(None, description=\"Configuration for serverless deployment\")\n    pod_config: Optional[Dict[str, Any]] = Field(None, description=\"Configuration for pod-based deployment\")\n    hybrid_search: bool = Field(False, description=\"Whether to enable hybrid search\")\n    metric: str = Field(\"cosine\", description=\"Distance metric for vector similarity\")\n    batch_size: int = Field(100, description=\"Batch size for operations\")\n    extra_params: Optional[Dict[str, Any]] = Field(None, description=\"Additional parameters for Pinecone client\")\n    namespace: Optional[str] = Field(None, description=\"Namespace for the collection\")\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def check_api_key_or_client(cls, values: Dict[str, Any]) -> Dict[str, Any]:\n        api_key, client = values.get(\"api_key\"), values.get(\"client\")\n        if not api_key and not client and \"PINECONE_API_KEY\" not in os.environ:\n            raise ValueError(\n                \"Either 'api_key' or 'client' must be provided, or PINECONE_API_KEY environment variable must be set.\"\n            )\n        return values\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def check_pod_or_serverless(cls, values: Dict[str, Any]) -> Dict[str, Any]:\n        pod_config, serverless_config = values.get(\"pod_config\"), values.get(\"serverless_config\")\n        if pod_config and serverless_config:\n            raise ValueError(\n                \"Both 'pod_config' and 'serverless_config' cannot be specified. Choose one deployment option.\"\n            )\n        return values\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def validate_extra_fields(cls, values: Dict[str, Any]) -> Dict[str, Any]:\n        allowed_fields = set(cls.model_fields.keys())","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/configs/vector_stores/pinecone.py#L10-L46","documentation":"Error \"Either 'api_key' or 'client' must be provided, or PINECONE_API_KEY environment variable must be set.\" thrown in mem0ai/mem0.","triggerScenarios":"Thrown at mem0/configs/vector_stores/pinecone.py:28 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass api_key or client in the Pinecone config, or set the PINECONE_API_KEY environment variable."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}