Skip to content

fix: catch RuntimeError in command execution (#4988)#4995

Open
jjjojoj wants to merge 1 commit intoAider-AI:mainfrom
jjjojoj:fix-runtime-error-client
Open

fix: catch RuntimeError in command execution (#4988)#4995
jjjojoj wants to merge 1 commit intoAider-AI:mainfrom
jjjojoj:fix-runtime-error-client

Conversation

@jjjojoj
Copy link
Copy Markdown

@jjjojoj jjjojoj commented Apr 5, 2026

Summary

Fixes #4988

A RuntimeError from HuggingFace embedding model download (e.g., RuntimeError: Cannot send a request, as the client has been closed) was not being caught in preproc_user_input, causing aider to crash.

Changes

  • Wrapped self.commands.run(inp) in try-except to catch RuntimeError
  • Shows user-friendly error message instead of crashing

Test plan

  • Run aider with network issues when HuggingFace model download fails
  • Run a command that triggers embedding download when HTTP client is closed
  • Should show error message and continue running instead of crashing with traceback

RuntimeError from HuggingFace embedding model download (or other
sources) was not being caught, causing aider to crash. Wrap the
commands.run() call in try-except to show a user-friendly error
message instead of crashing.

Fixes Aider-AI#4988
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught RuntimeError in _client.py line 901

1 participant