Aider-AI / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
22.7k stars 2.11k forks source link

Uncaught RateLimitError in utils.py line 7251 #1633

Closed SaulJWu closed 1 month ago

SaulJWu commented 2 months ago

Aider version: 0.57.1 Python version: 3.9.19 Platform: macOS-14.6.1-arm64-arm-64bit Python implementation: CPython Virtual environment: No OS: Darwin 23.6.0 (64bit) Git version: git version 2.39.5 (Apple Git-154)

An uncaught exception occurred:

Traceback (most recent call last):
  File "vertex_and_google_ai_studio_gemini.py", line 1397, in completion
    response = client.post(url=url, headers=headers, json=data)  # type: ignore
  File "http_handler.py", line 371, in post
    raise e
  File "http_handler.py", line 357, in post
    response.raise_for_status()
  File "_models.py", line 763, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '429 Too Many Requests' for url 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-pro-exp-0827:generateContent?key=AIzaSyBXl6jt1SuzqmOwjolX0tMxHCTxA2BfTtk'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 2080, in completion
    response = vertex_chat_completion.completion(  # type: ignore
  File "vertex_and_google_ai_studio_gemini.py", line 1401, in completion
    raise VertexAIError(status_code=error_code, message=err.response.text)
litellm.llms.vertex_ai_and_google_ai_studio.common_utils.VertexAIError: {
  "error": {
    "code": 429,
    "message": "Resource has been exhausted (e.g. check quota).",
    "status": "RESOURCE_EXHAUSTED"
  }
}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "aider", line 8, in <module>
    sys.exit(main())
  File "main.py", line 709, in main
    coder.run()
  File "base_coder.py", line 723, in run
    self.run_one(user_message, preproc)
  File "base_coder.py", line 766, in run_one
    list(self.send_message(message))
  File "base_coder.py", line 1193, in send_message
    saved_message = self.auto_commit(edited)
  File "base_coder.py", line 1874, in auto_commit
    res = self.repo.commit(fnames=edited, context=context, aider_edits=True)
  File "repo.py", line 102, in commit
    commit_message = self.get_commit_message(diffs, context)
  File "repo.py", line 187, in get_commit_message
    commit_message = simple_send_with_retries(
  File "sendchat.py", line 44, in wrapper
    return decorated_func(*args, **kwargs)
  File "_sync.py", line 105, in retry
    ret = target(*args, **kwargs)
  File "sendchat.py", line 107, in simple_send_with_retries
    _hash, response = send_completion(**kwargs)
  File "sendchat.py", line 87, in send_completion
    res = litellm.completion(**kwargs)
  File "utils.py", line 1086, in wrapper
    raise e
  File "utils.py", line 974, in wrapper
    result = original_function(*args, **kwargs)
  File "main.py", line 2847, in completion
    raise exception_type(
  File "utils.py", line 8194, in exception_type
    raise e
  File "utils.py", line 7251, in exception_type
    raise RateLimitError(
litellm.exceptions.RateLimitError: litellm.RateLimitError: litellm.RateLimitError: VertexAIException - {
  "error": {
    "code": 429,
    "message": "Resource has been exhausted (e.g. check quota).",
    "status": "RESOURCE_EXHAUSTED"
  }
}
fry69 commented 2 months ago

Thank you for filing this issue.

The error

Resource has been exhausted (e.g. check quota).

should be self-explanatory. If you use Google GCP/Vertex AI and this happens instantly, maybe you have set the wrong region/location, where your quota is set to 0 by default. Otherwise you may have exceeded your quota limits.

fry69 commented 1 month ago

I'm closing this issue for now.

If any new related concerns arise, please feel free to comment, and I'll reopen the issue.