hermes - ✅(Solved) Fix [Bug]: hermes update can crash with UnicodeDecodeError on config migration prompt in interactive TTY [1 pull requests, 2 comments, 2 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#12881Fetched 2026-04-20 12:16:25
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
commented ×2closed ×1cross-referenced ×1labeled ×1

Error Message

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

PR fix notes

PR #12886: fix(update): handle UnicodeDecodeError in post-update config migration prompt

Description (problem / solution / changelog)

Problem

hermes update crashes with UnicodeDecodeError at the post-update config migration prompt when stdin produces malformed decoded bytes — even though EOFError was already handled for non-interactive sessions.

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0

The actual update completes successfully — only the final prompt crashes.

Fix

Add UnicodeDecodeError to the existing except EOFError clause. On decode failure, print a friendly message, set response = "n", and instruct the user to run hermes config migrate manually.

Result

hermes update completes cleanly regardless of terminal stdin encoding issues.

Fixes #12881

Changed files

  • hermes_cli/main.py (modified, +4/-0)

Code Example

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte

---

input("Would you like to configure them now? [Y/n]: ")

---

Traceback (most recent call last):
      File "/home/zeus/.local/bin/hermes", line 10, in <module>
        sys.exit(main())
      File "/home/zeus/.hermes/hermes-agent/hermes_cli/main.py", line 8444, in main
        if not hasattr(args, attr):
      File "/home/zeus/.hermes/hermes-agent/hermes_cli/main.py", line 5186, in cmd_update
        _cmd_update_impl(args, gateway_mode=gateway_mode)
      File "/home/zeus/.hermes/hermes-agent/hermes_cli/main.py", line 5578, in _cmd_update_impl
        input("Would you like to configure them now? [Y/n]: ")
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte

---

Debug report upload failed from this environment:
    - `hermes debug share --lines 300`
    - paste.rs: remote end closed connection without response
    - dpaste.com: SSL handshake timeout

---



---

try:
        response = input("Would you like to configure them now? [Y/n]: ").strip().lower()
    except EOFError:
        response = "n"
    except UnicodeDecodeError:
        print("  ℹ Unreadable terminal input — skipping config migration prompt.")
        print("    Run 'hermes config migrate' later to apply any new config/env options.")
        response = "n"

---

try:
        response = input("Would you like to configure them now? [Y/n]: ").strip().lower()
    except EOFError:
        response = "n"
    except UnicodeDecodeError:
        print("  ℹ Unreadable terminal input — skipping config migration prompt.")
        print("    Run 'hermes config migrate' later to apply any new config/env options.")
        response = "n"
RAW_BUFFERClick to expand / collapse

Bug Description

`hermes update` can crash after a successful code/dependency update when it reaches the post-update config migration prompt:

`Would you like to configure them now? [Y/n]:`

In some interactive terminal contexts, `input()` raises:

```text
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte
```

This causes the update command to exit with a traceback even though the actual update already completed.

Steps to Reproduce

1. Run `hermes update` in an interactive terminal
2. Let the update reach the config migration prompt
3. Answer the prompt in a terminal/input environment that produces malformed decoded stdin bytes
4. Observe crash at:

```python
input("Would you like to configure them now? [Y/n]: ")
```

Expected Behavior

If terminal input cannot be decoded cleanly, `hermes update` should not crash.

It should:
- print a friendly message
- skip the config migration prompt
- continue successfully
- instruct the user to run `hermes config migrate` manually later

Actual Behavior

The command exits with a traceback like:

```text
Traceback (most recent call last):
  File "/home/zeus/.local/bin/hermes", line 10, in <module>
    sys.exit(main())
  File "/home/zeus/.hermes/hermes-agent/hermes_cli/main.py", line 8444, in main
    if not hasattr(args, attr):
  File "/home/zeus/.hermes/hermes-agent/hermes_cli/main.py", line 5186, in cmd_update
    _cmd_update_impl(args, gateway_mode=gateway_mode)
  File "/home/zeus/.hermes/hermes-agent/hermes_cli/main.py", line 5578, in _cmd_update_impl
    input("Would you like to configure them now? [Y/n]: ")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte
```

Affected Component

CLI (interactive chat), Other

Messaging Platform (if gateway-related)

N/A (CLI only)

Debug Report

Debug report upload failed from this environment:
    - `hermes debug share --lines 300`
    - paste.rs: remote end closed connection without response
    - dpaste.com: SSL handshake timeout

Operating System

Debian 11

Python Version

3.9.2

Hermes Version

0.10.0

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

There are already fixes for non-interactive update flows (`isatty()` checks / `EOFError` handling), but this path still does not handle `UnicodeDecodeError` from interactive `input()`.

So the non-interactive case is covered, but an interactive malformed-stdin decoding failure still crashes the update flow.

## Proposed Fix

Wrap the prompt with `UnicodeDecodeError` handling in addition to the existing fallback logic:

```python
try:
    response = input("Would you like to configure them now? [Y/n]: ").strip().lower()
except EOFError:
    response = "n"
except UnicodeDecodeError:
    print("  ℹ Unreadable terminal input — skipping config migration prompt.")
    print("    Run 'hermes config migrate' later to apply any new config/env options.")
    response = "n"
```

Proposed Fix (optional)

Handle `UnicodeDecodeError` alongside the existing `EOFError` fallback in the post-update config migration prompt, and treat it as a non-fatal “skip and continue” condition.

For example:

```python
try:
    response = input("Would you like to configure them now? [Y/n]: ").strip().lower()
except EOFError:
    response = "n"
except UnicodeDecodeError:
    print("  ℹ Unreadable terminal input — skipping config migration prompt.")
    print("    Run 'hermes config migrate' later to apply any new config/env options.")
    response = "n"
```

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

The hermes update command can be fixed by wrapping the interactive prompt with UnicodeDecodeError handling to prevent crashes due to malformed terminal input.

Guidance

  • Identify the line of code where the input() function is called and wrap it with a try-except block to catch UnicodeDecodeError.
  • In the except block, print a friendly message indicating that the config migration prompt will be skipped and instruct the user to run hermes config migrate manually later.
  • Set the response to a default value (e.g., "n") to continue the update process without crashing.
  • Verify that the fix works by testing the hermes update command in an interactive terminal with malformed input.

Example

try:
    response = input("Would you like to configure them now? [Y/n]: ").strip().lower()
except EOFError:
    response = "n"
except UnicodeDecodeError:
    print("  ℹ Unreadable terminal input — skipping config migration prompt.")
    print("    Run 'hermes config migrate' later to apply any new config/env options.")
    response = "n"

Notes

This fix assumes that the hermes update command is the only place where this issue occurs. If similar issues are found in other parts of the code, the fix may need to be applied more broadly.

Recommendation

Apply the workaround by wrapping the input() function with UnicodeDecodeError handling, as this will prevent the command from crashing due to malformed terminal input.

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