Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Uncaught OSError in _win32_console.py line 403/faarax

Open
#5,652 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Quiet
Tech stack
python

Research direction

Start at _win32_console.py line 403 and trace the call from _windows_renderer.py through io.py when the provider error is displayed. Reproduce the Windows 10 failure using the error path in base_coder.py, then verify that the original 404 error is reported without an uncaught OSError from console output.

Written by the indexing model from the issue text.

Description

Aider version: 0.86.2
Python version: 3.12.10
Platform: Windows-10-10.0.19045-SP0
Python implementation: CPython
Virtual environment: Yes
OS: Windows 10 (64bit)
Git version: git version 2.55.0.windows.3

An uncaught exception occurred:

Traceback (most recent call last):
  File "llm_http_handler.py", line 221, in _make_common_sync_call
    response = sync_httpx_client.post(
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "http_handler.py", line 1028, in post
    raise e
  File "http_handler.py", line 1010, in post
    response.raise_for_status()
  File "_models.py", line 829, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '404 Not Found' for url 'https://openrouter.ai/api/v1/chat/completions'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 3212, in completion
    response = base_llm_http_handler.completion(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "llm_http_handler.py", line 508, in completion
    completion_stream, headers = self.make_sync_call(
                                 ^^^^^^^^^^^^^^^^^^^^
  File "llm_http_handler.py", line 598, in make_sync_call
    response = self._make_common_sync_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "llm_http_handler.py", line 246, in _make_common_sync_call
    raise self._handle_error(e=e, provider_config=provider_config)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "llm_http_handler.py", line 4623, in _handle_error
    raise provider_config.get_error_class(
litellm.llms.openrouter.common_utils.OpenRouterException: {"error":{"message":"No endpoints found for anthropic/claude-3-opus.","code":404},"user_id":"user_3IdW2BKtcxpDkU7mjfcGPTEVAto"}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "base_coder.py", line 1459, in send_message
    yield from self.send(messages, functions=self.functions)
  File "base_coder.py", line 1797, in send
    hash_object, completion = model.send_completion(
                              ^^^^^^^^^^^^^^^^^^^^^^
  File "models.py", line 1021, in send_completion
    res = litellm.completion(**kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "utils.py", line 1748, in wrapper
    raise e
  File "utils.py", line 1569, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "main.py", line 4305, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "exception_mapping_utils.py", line 2378, in exception_type
    raise e
  File "exception_mapping_utils.py", line 2258, in exception_type
    raise NotFoundError(
litellm.exceptions.NotFoundError: litellm.NotFoundError: NotFoundError: OpenrouterException - {"error":{"message":"No endpoints found for anthropic/claude-3-opus.","code":404},"user_id":"user_3IdW2BKtcxpDkU7mjfcGPTEVAto"}

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 5, in <module>
    sys.exit(main())
             ^^^^^^
  File "main.py", line 1162, in main
    coder.run()
  File "base_coder.py", line 887, in run
    self.run_one(user_message, preproc)
  File "base_coder.py", line 934, in run_one
    list(self.send_message(message))
  File "base_coder.py", line 1476, in send_message
    self.check_and_open_urls(err, ex_info.description)
  File "base_coder.py", line 954, in check_and_open_urls
    self.io.tool_error(text)
  File "io.py", line 990, in tool_error
    self._tool_message(message, strip, self.tool_error_color)
  File "io.py", line 980, in _tool_message
    self.console.print(message, **style)
  File "console.py", line 1697, in print
    with self:
         ^^^^
  File "console.py", line 870, in __exit__
    self._exit_buffer()
  File "console.py", line 826, in _exit_buffer
    self._check_buffer()
  File "console.py", line 2042, in _check_buffer
    self._write_buffer()
  File "console.py", line 2078, in _write_buffer
    legacy_windows_render(buffer, LegacyWindowsTerm(self.file))
  File "_windows_renderer.py", line 19, in legacy_windows_render
    term.write_text(text)
  File "_win32_console.py", line 403, in write_text
    self.flush()
OSError: [Errno 22] Invalid argument

Dominant language
Python
Stars
49.4k
Forks
5k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Aider-AI/aider

All issues in Aider-AI/aider

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.