paul-gauthier / aider

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

Uncaught APIError in utils.py line 8366 #1526

Open geeknik opened 5 days ago

geeknik commented 5 days ago

Aider version: 0.56.0 Python version: 3.12.6 Platform: macOS-15.1-arm64-arm-64bit Python implementation: CPython Virtual environment: Yes OS: Darwin 24.1.0 (64bit) Git version: git version 2.46.0

An uncaught exception occurred:

Traceback (most recent call last):
  File "openai.py", line 1033, in completion
    raise e
  File "openai.py", line 966, in completion
    return convert_to_model_response_object(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "utils.py", line 6016, 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 1925, in completion
    response = openai_chat_completions.completion(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "openai.py", line 1039, in completion
    raise OpenAIError(status_code=e.status_code, message=str(e))
litellm.llms.openai.OpenAIError

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 698, in main
    coder.run()
  File "base_coder.py", line 735, in run
    self.run_one(user_message, preproc)
  File "base_coder.py", line 778, in run_one
    list(self.send_message(message))
  File "base_coder.py", line 1202, in send_message
    saved_message = self.auto_commit(edited)
                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "base_coder.py", line 1885, 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 106, in simple_send_with_retries
    _hash, response = send_completion(**kwargs)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "sendchat.py", line 86, in send_completion
    res = litellm.completion(**kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "utils.py", line 1078, in wrapper
    raise e
  File "utils.py", line 966, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "main.py", line 2766, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "utils.py", line 8438, in exception_type
    raise e
  File "utils.py", line 8366, in exception_type
    raise APIError(
litellm.exceptions.APIError: litellm.APIError: APIError: OpenrouterException - 
fry69 commented 5 days ago

Thank you for filing this issue.

It looks like OpenRouter returned an unspecified error, which makes it hard to tell what is actually going on.

Can you please post more details, e.g. which model you used when this error occurred or other possibly helpful information?

geeknik commented 5 days ago

I was using openrouter/openai/o1-preview but I didn't manage to capture anything about the error state beyond this unfortunately.

fry69 commented 5 days ago

I was using openrouter/openai/o1-preview but I didn't manage to capture anything about the error state beyond this unfortunately.

Support for o1 models in currently only available in the main branch, you can install it with

aider --install-main-branch

Please report if you can get this working with OpenRouter, so far it was only tested against the OpenAI API.