{"record":{"id":"9d3975bfe088ac4e","repo":"BerriAI/litellm","slug":"missing-vertex-project-set-vertexai-project-envi","errorCode":null,"errorMessage":"Missing vertex_project - Set VERTEXAI_PROJECT environment variable or pass vertex_project parameter","messagePattern":"Missing vertex_project - Set VERTEXAI_PROJECT environment variable or pass vertex_project parameter","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/ocr/deepseek_transformation.py","lineNumber":113,"sourceCode":"        Get complete URL for Vertex AI DeepSeek OCR endpoint.\n\n        Args:\n            api_base: Vertex AI API base URL (optional)\n            model: Model name (e.g., \"deepseek-ai/deepseek-ocr-maas\")\n            optional_params: Optional parameters\n            litellm_params: LiteLLM parameters containing vertex_project, vertex_location\n\n        Returns: Complete URL for Vertex AI OCR endpoint\n        \"\"\"\n        # Extract Vertex AI parameters using safe helpers from VertexBase\n        # Use safe_get_* methods that don't mutate litellm_params dict\n        litellm_params = litellm_params or {}\n\n        vertex_project: Final = VertexBase.safe_get_vertex_ai_project(litellm_params=litellm_params)\n        vertex_location = VertexBase.safe_get_vertex_ai_location(litellm_params=litellm_params)\n\n        if vertex_project is None:\n            raise ValueError(\n                \"Missing vertex_project - Set VERTEXAI_PROJECT environment variable or pass vertex_project parameter\"\n            )\n\n        if vertex_location is None:\n            vertex_location = \"us-central1\"\n\n        # Get API base URL\n        if api_base is None:\n            api_base = \"https://aiplatform.googleapis.com\"\n\n        # Ensure no trailing slash\n        api_base = api_base.rstrip(\"/\")\n\n        return f\"{api_base}/v1/projects/{vertex_project}/locations/{vertex_location}/endpoints/openapi/chat/completions\"\n\n    def transform_ocr_request(\n        self,\n        model: str,","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/ocr/deepseek_transformation.py#L95-L131","documentation":"ValueError raised while building the Vertex AI DeepSeek OCR endpoint URL: no Google Cloud project could be resolved. The handler reads vertex_project from litellm_params via VertexBase.safe_get_vertex_ai_project (which also checks the VERTEXAI_PROJECT environment variable); if nothing is found, the projects/{project}/... URL cannot be constructed and the call aborts before any request is sent.","triggerScenarios":"Calling the Vertex AI OCR handler with a 'vertex_ai/deepseek-ai/deepseek-ocr' style model without a vertex_project litellm_param and without VERTEXAI_PROJECT set in the environment.","commonSituations":"Container deployments where only GOOGLE_APPLICATION_CREDENTIALS is set - credentials alone do not supply the project for this handler; assuming the project is inferred from the credentials JSON; typo in the env var name.","solutions":["Export VERTEXAI_PROJECT=<gcp-project-id> in the environment of the process calling litellm","Or pass vertex_project='my-project' in the request's litellm_params / router deployment litellm_params","Verify it resolves: echo $VERTEXAI_PROJECT","If using the LiteLLM proxy, set vertex_project in the model deployment config"],"exampleFix":"# before\nlitellm.ocr(model='vertex_ai/deepseek-ai/deepseek-ocr', document={'type': 'document_url', 'document_url': url})\n\n# after - either set the env var...\n# export VERTEXAI_PROJECT=my-project\n\n# ...or pass the parameter explicitly\nlitellm.ocr(\n    model='vertex_ai/deepseek-ai/deepseek-ocr',\n    vertex_project='my-project',\n    document={'type': 'document_url', 'document_url': url},\n)","handlingStrategy":"validation","validationCode":"import os\n\nproject = os.environ.get('VERTEXAI_PROJECT')\nassert project, 'VERTEXAI_PROJECT not set - vertex_ai OCR calls will fail at URL construction'","typeGuard":null,"tryCatchPattern":"try:\n    litellm.ocr(model=model, document=doc)\nexcept ValueError as e:\n    if 'vertex_project' in str(e):\n        raise SystemExit('Set VERTEXAI_PROJECT or pass vertex_project')\n    raise","preventionTips":["Set VERTEXAI_PROJECT in every environment that calls Vertex handlers","Centralize GCP project/location in router deployment litellm_params","Fail fast at startup by asserting required Vertex env vars"],"tags":["vertex-ai","ocr","configuration","gcp-project"],"backgroundTag":"missing-env-var","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}