hermes - ✅(Solved) Fix CLI crash on startup: Invalid key 'c-S-c' — prompt_toolkit doesn't support Shift modifier [2 pull requests, 7 comments, 6 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#19903Fetched 2026-05-05 06:04:28
View on GitHub
Comments
7
Participants
6
Timeline
12
Reactions
4
Timeline (top)
commented ×7labeled ×3cross-referenced ×2

Error Message

Error: Invalid key: c-S-c

Root Cause

cli.py:10487 registers @kb.add('c-S-c') for a no-op Ctrl+Shift+C handler. prompt_toolkit does not support uppercase Shift modifiers in keybinding strings — neither c-S-c nor c-s-c are valid.

Fix Action

Fix

Comment out or remove the @kb.add('c-S-c') decorator (lines ~10487). The handler is a no-op that simply returns — removing the binding has no functional impact.

PR fix notes

PR #19907: fix(cli): remove invalid ctrl-shift-c keybinding

Description (problem / solution / changelog)

What does this PR do?

Removes the @kb.add('c-S-c') prompt_toolkit binding that crashes Hermes startup with Error: Invalid key: c-S-c.

The handler was a no-op intended to let terminals handle Ctrl+Shift+C. Because prompt_toolkit rejects that key spec on affected installs, registering it aborts CLI startup before the prompt opens. Removing it preserves terminal-native copy behavior and avoids registering an invalid key.

This is an alternative to #19895. That PR keeps the binding behind try/except; this PR removes the no-op binding entirely and adds a regression test that validates literal CLI keybindings against prompt_toolkit.

Related Issue

Fixes #19894 Fixes #19896 Fixes #19903

Related: #19895 Regression introduced by #19884

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • cli.py: removed the invalid no-op c-S-c binding.
  • tests/cli/test_cli_keybindings.py: added a regression test that parses literal @kb.add(...) decorators in cli.py and verifies prompt_toolkit can register them.

How to Test

  1. On an affected checkout, run hermes; before this fix it exits during startup with Error: Invalid key: c-S-c.
  2. Run .venv/bin/python -m py_compile cli.py.
  3. Run scripts/run_tests.sh tests/cli/test_cli_keybindings.py -q.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Linux / WSL

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

Validation run locally:

.venv/bin/python -m py_compile cli.py
scripts/run_tests.sh tests/cli/test_cli_keybindings.py -q

1 passed in 2.96s

Changed files

  • cli.py (modified, +0/-15)
  • tests/cli/test_cli_keybindings.py (added, +51/-0)

PR #19912: fix(cli): remove invalid 'c-S-c' keybinding that crashes prompt_toolkit

Description (problem / solution / changelog)

Summary

Remove the invalid @kb.add('c-S-c') keybinding registration at cli.py:10487 that causes hermes and hermes chat to crash on startup with:

Error: Invalid key: c-S-c

Root Cause

prompt_toolkit does not support Shift modifiers (S-) in keybinding strings. The c-S-c syntax is not recognized, causing an immediate crash before the CLI can render.

Fix

Removed the 14-line handle_ctrl_shift_c handler (decorator + docstring + no-op return). The handler was intentionally a no-op — its purpose was to prevent Hermes from intercepting Ctrl+Shift+C as an interrupt, but terminal emulators handle this keystroke at the OS level before it reaches the application, so the binding was unnecessary.

Testing

  • Verified c-S-c no longer appears anywhere in cli.py
  • Ran CLI test suite (pytest tests/ -k cli): 2180 passed, pre-existing failures unrelated to this change
  • No other keybindings affected

Checklist

  • Scope: 1 file (cli.py), 15 lines removed
  • No new dependencies
  • No breaking changes

Closes #19903

Changed files

  • cli.py (modified, +0/-15)

Code Example

Error: Invalid key: c-S-c
RAW_BUFFERClick to expand / collapse

Bug Description

hermes and hermes chat crash immediately after rendering the banner with:

Error: Invalid key: c-S-c

Root Cause

cli.py:10487 registers @kb.add('c-S-c') for a no-op Ctrl+Shift+C handler. prompt_toolkit does not support uppercase Shift modifiers in keybinding strings — neither c-S-c nor c-s-c are valid.

Fix

Comment out or remove the @kb.add('c-S-c') decorator (lines ~10487). The handler is a no-op that simply returns — removing the binding has no functional impact.

Environment

  • macOS (Apple Silicon, Mac Mini M4)
  • Hermes Agent v0.12.0 (2026.4.30) · upstream 8fabef9d
  • Python 3.11
  • Terminal: macOS Terminal.app

extent analysis

TL;DR

Comment out or remove the @kb.add('c-S-c') decorator in cli.py to fix the crash.

Guidance

  • The issue is caused by an invalid keybinding string c-S-c which is not supported by prompt_toolkit.
  • To verify the fix, remove the decorator and run the application to check if it crashes after rendering the banner.
  • The handler associated with the keybinding is a no-op, so removing it should not have any functional impact.
  • Ensure that the cli.py file is updated correctly and the changes are saved before running the application again.

Example

No code snippet is necessary in this case, as the fix is a simple removal of a decorator.

Notes

This fix assumes that the cli.py file can be modified directly. If the file is part of a larger project or is generated, additional steps may be necessary to apply the fix.

Recommendation

Apply the workaround by removing the @kb.add('c-S-c') decorator, as it is a simple and non-intrusive fix that should resolve the crash 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 - ✅(Solved) Fix CLI crash on startup: Invalid key 'c-S-c' — prompt_toolkit doesn't support Shift modifier [2 pull requests, 7 comments, 6 participants]