Skip to content

ERROR on startup of claude code when using Gemini: Error processing request: { "error": "litellm.InternalServerError: VertexAIException InternalServerError ... #52

@epicwhale

Description

@epicwhale

I notice whenever I start claude code and it connects to this proxy, there's a failure/error request at the beginning (logs below)

This is my .env

GEMINI_API_KEY="######"
PREFERRED_PROVIDER="google"
BIG_MODEL="gemini-2.5-pro"
SMALL_MODEL="gemini-2.5-flash"

Error in log

❯ uv run uvicorn server:app --host 0.0.0.0 --port 8082 --reload
INFO:     Will watch for changes in these directories: ['/Users/######/######/claude-code-proxy']
INFO:     Uvicorn running on http://0.0.0.0:8082 (Press CTRL+C to quit)
INFO:     Started reloader process [3390] using WatchFiles
POST /v1/messages ✓ 200 OK
claude-3-5-haiku-20241022 → gemini-2.5-flash 0 tools 1 messages
19:18:24 - LiteLLM:INFO: utils.py:2999 -
LiteLLM completion() model= gemini-2.5-flash; provider = gemini
2025-09-10 19:18:24,673 - INFO -
LiteLLM completion() model= gemini-2.5-flash; provider = gemini
2025-09-10 19:18:24,945 - INFO - HTTP Request: POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key=######BLHV-ShNOF_E "HTTP/1.1 500 Internal Server Error"

Give Feedback / Get Help: https://github.com/BerriAI/litellm/issues/new
LiteLLM.Info: If you need to debug this error, use `litellm._turn_on_debug()'.

2025-09-10 19:18:24,958 - ERROR - Error processing request: {
  "error": "litellm.InternalServerError: VertexAIException InternalServerError - {\n  \"error\": {\n    \"code\": 500,\n    \"message\": \"An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting\",\n    \"status\": \"INTERNAL\"\n  }\n}\n",
  "type": "InternalServerError",
  "traceback": "Traceback (most recent call last):\n  File \"/Users/######/######/claude-code-proxy/.venv/lib/python3.10/site-packages/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py\", line 1282, in completion\n    response = client.post(url=url, headers=headers, json=data)  # type: ignore\n  File \"/Users/######/######/claude-code-proxy/.venv/lib/python3.10/site-packages/litellm/llms/custom_httpx/http_handler.py\", line 557, in post\n    raise e\n  File \"/Users/######/######/claude-code-proxy/.venv/lib/python3.10/site-packages/litellm/llms/custom_httpx/http_handler.py\", line 538, in post\n    response.raise_for_status()\n  File \"/Users/######/######/claude-code-proxy/.venv/lib/python3.10/site-packages/httpx/_models.py\", line 829, in raise_for_status\n    raise HTTPStatusError(message, request=request, response=self)\nhttpx.HTTPStatusError: Server error '500 Internal Server Error' for url 'https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key=######BLHV-ShNOF_E'\nFor more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/Users/######/######/claude-code-proxy/.venv/lib/python3.10/site-packages/litellm/main.py\", line 2348, in completion\n    response = vertex_chat_completion.completion(  # type: ignore\n  File \"/Users/######/######/claude-code-proxy/.venv/lib/python3.10/site-packages/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py\", line 1286, in completion\n    raise VertexAIError(\nlitellm.llms.vertex_ai.common_utils.VertexAIError: {\n  \"error\": {\n    \"code\": 500,\n    \"message\": \"An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting\",\n    \"status\": \"INTERNAL\"\n  }\n}\n\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/Users/######/######/claude-code-proxy/server.py\", line 1312, in create_message\n    litellm_response = litellm.completion(**litellm_request)\n  File \"/Users/######/######/claude-code-proxy/.venv/lib/python3.10/site-packages/litellm/utils.py\", line 1235, in wrapper\n    raise e\n  File \"/Users/######/######/claude-code-proxy/.venv/lib/python3.10/site-packages/litellm/utils.py\", line 1113, in wrapper\n    result = original_function(*args, **kwargs)\n  File \"/Users/######/######/claude-code-proxy/.venv/lib/python3.10/site-packages/litellm/main.py\", line 3137, in completion\n    raise exception_type(\n  File \"/Users/######/######/claude-code-proxy/.venv/lib/python3.10/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py\", line 2214, in exception_type\n    raise e\n  File \"/Users/######/######/claude-code-proxy/.venv/lib/python3.10/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py\", line 1269, in exception_type\n    raise litellm.InternalServerError(\nlitellm.exceptions.InternalServerError: litellm.InternalServerError: VertexAIException InternalServerError - {\n  \"error\": {\n    \"code\": 500,\n    \"message\": \"An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting\",\n    \"status\": \"INTERNAL\"\n  }\n}\n\n",
  "message": "litellm.InternalServerError: VertexAIException InternalServerError - {\n  \"error\": {\n    \"code\": 500,\n    \"message\": \"An internal error has occurred. Please retry or report in https://developers.generativeai.google/guide/troubleshooting\",\n    \"status\": \"INTERNAL\"\n  }\n}\n",
  "status_code": 500,
  "response": {
    "status_code": 500,
    "headers": {
      "_list": [],
      "_encoding": "ascii"
    },
    "_request": {
      "method": "POST",
      "url": {
        "_uri_reference": [
          "",
          "",
          "",
          null,
          "%20https://cloud.google.com/vertex-ai/",
          null,
          null
        ]
      },
      "headers": {
        "_list": [
          "(b'Content-Length', b'content-length', b'0')"
        ],
        "_encoding": null
      },
      "extensions": {},
      "stream": {
        "_stream": "b''"
      },
      "_content": "b''"
    },
    "next_request": null,
    "extensions": {},
    "history": [],
    "is_closed": true,
    "is_stream_consumed": true,
    "default_encoding": "utf-8",
    "stream": {
      "_stream": "b''"
    },
    "_decoder": {},
    "_num_bytes_downloaded": 0,
    "_content": "b''"
  },
  "llm_provider": "vertex_ai",
  "model": "gemini-2.5-flash",
  "litellm_debug_info": "\nModel: gemini-2.5-flash\nMessages: `[{'role': 'user', 'content': 'quota'}]`",
  "max_retries": "None",
  "num_retries": "None",
  "request": "<Request('POST', '%20https://cloud.google.com/vertex-ai/')>",
  "body": "None",
  "code": "None",
  "param": "None",
  "request_id": "None",
  "litellm_response_headers": "Headers([('vary', 'Origin'), ('vary', 'X-Origin'), ('vary', 'Referer'), ('content-type', 'application/json; charset=UTF-8'), ('content-encoding', 'gzip'), ('date', 'Wed, 10 Sep 2025 18:18:24 GMT'), ('server', 'scaffolding on HTTPServer2'), ('x-xss-protection', '0'), ('x-frame-options', 'SAMEORIGIN'), ('x-content-type-options', 'nosniff'), ('server-timing', 'gfet4t7; dur=182'), ('alt-svc', 'h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000'), ('transfer-encoding', 'chunked')])"
}
POST /v1/messages ✓ 200 OK
claude-3-5-haiku-20241022 → gemini-2.5-flash 0 tools 2 messages
19:18:24 - LiteLLM:INFO: utils.py:2999 -
LiteLLM completion() model= gemini-2.5-flash; provider = gemini
2025-09-10 19:18:24,972 - INFO -
LiteLLM completion() model= gemini-2.5-flash; provider = gemini
POST /v1/messages ✓ 200 OK
claude-3-5-haiku-20241022 → gemini-2.5-flash 0 tools 2 messages

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions