Skip to content

fix: handle MissingStyle in display_user_input (issue #2962)#5361

Open
chrislazar25 wants to merge 1 commit into
Aider-AI:mainfrom
chrislazar25:fix/issue-2962
Open

fix: handle MissingStyle in display_user_input (issue #2962)#5361
chrislazar25 wants to merge 1 commit into
Aider-AI:mainfrom
chrislazar25:fix/issue-2962

Conversation

@chrislazar25

@chrislazar25 chrislazar25 commented Jun 30, 2026

Copy link
Copy Markdown

Summary: Fix crash when display_user_input() receives a color style Rich can't resolve by catching MissingStyle and falling back to uncolored output.

Technical Details:

  • Root Cause: confirm_ask()user_input()display_user_input()self.console.print(Text(inp), **style) raises MissingStyle when user_input_color contains a string not in Rich's style registry (e.g., invalid hex, unregistered theme token). No error handling exists at this call site.
  • Mechanism: The user's input is processed, the chat history logged, then display_user_input() attempts to print with the style — and crashes before the message reaches the user. The fix wraps the console.print() call in try/except MissingStyle, falling back to a plain uncolored print.

Verification: Confirmed adherence to CONTRIBUTING.md. Ran python -m pytest tests/ -x -q. 455 passed, 1 failed (test_voice_init_invalid_format — pre-existing, requires audio hardware, reproduces on main). Pre-commit hooks (isort, black, flake8, codespell) all green.

Blast Radius:

  • Impact: Low. Only affects the display_user_input code path in io.py.
  • Trade-offs: Degraded UX (no color) on style resolution failure versus a hard crash. No behavioral change for valid styles. No performance impact.

Fixes #2962

@chrislazar25 chrislazar25 marked this pull request as ready for review June 30, 2026 16:53
@chrislazar25

Copy link
Copy Markdown
Author

Fixes #2962

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 MissingStyle when choosing 'A' when prompted to add many files to the chat

1 participant