hermes - 💡(How to fix) Fix cli.py crashes on startup in WSL terminals that don't support c-S-c keybinding [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#20202Fetched 2026-05-06 06:38:05
View on GitHub
Comments
2
Participants
3
Timeline
7
Reactions
0
Timeline (top)
labeled ×3commented ×2mentioned ×1subscribed ×1

Error Message

Exception in handler for key c-S-c

Root Cause

cli.py crashes on startup in some WSL terminal emulators (e.g., Windows Terminal) when registering the Ctrl+Shift+C keyboard shortcut. The @kb.add('c-S-c') decorator raises an exception because the terminal doesn't support this key combination at the prompt_toolkit level.

Fix Action

Fix / Workaround

try:
    @kb.add('c-S-c')  # Ctrl+Shift+C
    def handle_ctrl_shift_c(event):
        """Copy text to clipboard (terminal-native)."""
        return
except Exception:
    pass  # WSL workaround

Code Example

Exception in handler for key c-S-c

---

try:
    @kb.add('c-S-c')  # Ctrl+Shift+C
    def handle_ctrl_shift_c(event):
        """Copy text to clipboard (terminal-native)."""
        return
except Exception:
    pass  # WSL workaround
RAW_BUFFERClick to expand / collapse

Bug Description

cli.py crashes on startup in some WSL terminal emulators (e.g., Windows Terminal) when registering the Ctrl+Shift+C keyboard shortcut. The @kb.add('c-S-c') decorator raises an exception because the terminal doesn't support this key combination at the prompt_toolkit level.

Steps to Reproduce

  1. Install Hermes Agent on WSL2 (Windows Subsystem for Linux)
  2. Run hermes in Windows Terminal (or any WSL terminal where Ctrl+Shift+C is handled by the terminal emulator for copy)
  3. The CLI crashes immediately on startup

Error

Exception in handler for key c-S-c

Expected Behavior

Hermes should start gracefully on WSL terminals. If a keyboard shortcut isn't supported, it should be silently skipped.

Suggested Fix

In cli.py, wrap the @kb.add('c-S-c') block in a try/except:

try:
    @kb.add('c-S-c')  # Ctrl+Shift+C
    def handle_ctrl_shift_c(event):
        """Copy text to clipboard (terminal-native)."""
        return
except Exception:
    pass  # WSL workaround

Environment

  • OS: WSL2 (Ubuntu on Windows)
  • Terminal: Windows Terminal
  • Hermes: v0.12.0
  • Python: 3.12.3

extent analysis

TL;DR

The issue can be resolved by wrapping the @kb.add('c-S-c') block in a try/except to catch and silently ignore exceptions when the terminal doesn't support the Ctrl+Shift+C keyboard shortcut.

Guidance

  • Verify that the terminal emulator is handling the Ctrl+Shift+C shortcut for copy, which might be the cause of the conflict.
  • Implement the suggested fix by wrapping the @kb.add('c-S-c') block in a try/except to prevent the CLI from crashing.
  • Consider logging the exception for debugging purposes, rather than completely ignoring it, to help identify any other potential issues.
  • Test the fix on different WSL terminal emulators to ensure the solution is robust.

Example

try:
    @kb.add('c-S-c')  # Ctrl+Shift+C
    def handle_ctrl_shift_c(event):
        """Copy text to clipboard (terminal-native)."""
        return
except Exception as e:
    print(f"Warning: Failed to register Ctrl+Shift+C shortcut: {e}")

Notes

This fix assumes that silently skipping the unsupported keyboard shortcut is the desired behavior. If the shortcut is essential, an alternative solution might be needed.

Recommendation

Apply the workaround by implementing the try/except block, as it provides a straightforward and non-intrusive fix for the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix cli.py crashes on startup in WSL terminals that don't support c-S-c keybinding [2 comments, 3 participants]