hermes - ✅(Solved) Fix fix: bundle_content_hash crashes with bytes values (AttributeError) [1 pull requests, 1 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#13408Fetched 2026-04-22 08:06:42
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
labeled ×4commented ×1cross-referenced ×1

Error Message

AttributeError: 'bytes' object has no attribute 'encode'. Did you mean: 'decode'?

Fix Action

Fix

content = bundle.files[rel_path]
if isinstance(content, bytes):
    h.update(content)
else:
    h.update(content.encode("utf-8"))

PR fix notes

PR #13531: fix(skills): handle bytes in bundle content hash

Description (problem / solution / changelog)

Summary

  • handle bytes entries in bundle_content_hash() without calling .encode()
  • preserve the existing hash behavior for text bundle files
  • add a regression test covering mixed bytes and str bundle content

Fixes #13408

Root Cause

bundle_content_hash() assumed every bundle.files[...] value was a str and always called .encode("utf-8"). SkillBundle.files is already typed as Dict[str, Union[str, bytes]], so any bundle containing raw bytes would crash during hermes skills update with AttributeError.

Validation

  • /Users/zzl/.hermes/hermes-agent-update-20260421/venv/bin/python -m pytest -o addopts= tests/tools/test_skills_hub.py -q
  • /Users/zzl/.hermes/hermes-agent-update-20260421/venv/bin/python -m py_compile tools/skills_hub.py tests/tools/test_skills_hub.py
  • git diff --check

Changed files

  • tests/tools/test_skills_hub.py (modified, +21/-0)
  • tools/skills_hub.py (modified, +5/-1)

Code Example

AttributeError: 'bytes' object has no attribute 'encode'. Did you mean: 'decode'?

---

h.update(bundle.files[rel_path].encode("utf-8"))

---

content = bundle.files[rel_path]
if isinstance(content, bytes):
    h.update(content)
else:
    h.update(content.encode("utf-8"))
RAW_BUFFERClick to expand / collapse

Bug

hermes skills update crashes with:

AttributeError: 'bytes' object has no attribute 'encode'. Did you mean: 'decode'?

Location

tools/skills_hub.py:2633 in bundle_content_hash():

h.update(bundle.files[rel_path].encode("utf-8"))

bundle.files[rel_path] can be bytes (not str), so .encode() fails.

Fix

content = bundle.files[rel_path]
if isinstance(content, bytes):
    h.update(content)
else:
    h.update(content.encode("utf-8"))

Reproduction

Run hermes skills update when any installed skill bundle has file contents stored as bytes.

Version

Hermes Agent v0.10.0 (2026.4.16), also present on latest origin/main.

extent analysis

TL;DR

The crash in hermes skills update can be fixed by conditionally encoding the bundle.files[rel_path] content based on its type.

Guidance

  • Check the type of bundle.files[rel_path] before attempting to encode it to avoid the AttributeError.
  • Use the provided fix to conditionally update the hash based on whether the content is bytes or a string.
  • Verify that the fix works by running hermes skills update after applying the change.
  • Ensure that the fix is applied to the correct version of the code, in this case, Hermes Agent v0.10.0 or later.

Example

content = bundle.files[rel_path]
if isinstance(content, bytes):
    h.update(content)
else:
    h.update(content.encode("utf-8"))

Notes

This fix assumes that the bundle.files[rel_path] content is either a string or bytes. If other types are possible, additional handling may be necessary.

Recommendation

Apply the provided workaround to conditionally encode the content based on its type, as it directly addresses the root cause of the crash.

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 fix: bundle_content_hash crashes with bytes values (AttributeError) [1 pull requests, 1 comments, 2 participants]