Aider-AI / aider

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

Uncaught APIError in utils.py line 8123 #2104

Closed soctib closed 4 days ago

soctib commented 5 days ago

Aider version: 0.59.1 Python version: 3.11.9 Platform: Windows-10-10.0.22631-SP0 Python implementation: CPython Virtual environment: Yes OS: Windows 10 (64bit) Git version: git version 2.43.0.windows.1

An uncaught exception occurred:

Traceback (most recent call last):
  File "openai.py", line 907, in completion
    raise e
  File "openai.py", line 840, in completion
    return convert_to_model_response_object(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "utils.py", line 5720, in convert_to_model_response_object
    raise raised_exception
Exception

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 1999, in completion
    response = openai_chat_completions.completion(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "openai.py", line 914, in completion
    raise OpenAIError(
litellm.llms.OpenAI.openai.OpenAIError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "__main__.py", line 7, in <module>
    sys.exit(main())
             ^^^^^^
  File "main.py", line 757, in main
    coder.run()
  File "base_coder.py", line 730, in run
    self.run_one(user_message, preproc)
  File "base_coder.py", line 773, in run_one
    list(self.send_message(message))
  File "base_coder.py", line 1197, in send_message
    self.reply_completed()
  File "architect_coder.py", line 40, in reply_completed
    editor_coder.run(with_message=content, preproc=False)
  File "base_coder.py", line 724, in run
    self.run_one(with_message, preproc)
  File "base_coder.py", line 773, in run_one
    list(self.send_message(message))
  File "base_coder.py", line 1212, in send_message
    saved_message = self.auto_commit(edited)
                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "base_coder.py", line 1895, in auto_commit
    res = self.repo.commit(fnames=edited, context=context, aider_edits=True)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "repo.py", line 110, in commit
    commit_message = self.get_commit_message(diffs, context)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "repo.py", line 195, 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 102, in simple_send_with_retries
    _hash, response = send_completion(**kwargs)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "sendchat.py", line 83, 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 8123, in exception_type
    raise APIError(
litellm.exceptions.APIError: litellm.APIError: APIError: OpenrouterException - 
paul-gauthier commented 4 days ago

Thanks for trying aider and filing this issue.

This is an error coming from the API provider. Aider retries multiple times over a 1 minute period before giving up. I don't think there's anything more aider can do about it. Something seems to be wrong with the API server you are hitting.

I'm going to close this issue for now, but feel free to add a comment here and I will re-open. Or feel free to file a new issue any time.