fix(tools): portable base64 encoding for image reading on macOS#5657
Merged
teknium1 merged 1 commit intoNousResearch:mainfrom Apr 6, 2026
Merged
fix(tools): portable base64 encoding for image reading on macOS#5657teknium1 merged 1 commit intoNousResearch:mainfrom
teknium1 merged 1 commit intoNousResearch:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
_read_image()intools/file_operations.pycalledbase64 -w 0toproduce unwrapped base64 output. The
-w 0flag is GNU coreutils syntaxand is not supported by macOS
base64. On macOS with the local terminalbackend this caused every
read_filecall on an image to fail silently(exit code != 0), returning a generic error instead of the base64 content.
Docker/Modal/SSH backends running Linux were unaffected.
Fix
Replaced
base64 -w 0 <path>withbase64 <path> | tr -d '\n'.Both GNU and macOS
base64wrap output by default; piping throughtr -d '\n'strips the newlines without needing any platform detection.This is portable across all terminal backends (local macOS, local Linux,
Docker, Modal, SSH to macOS or Linux hosts).
Testing
On macOS with the local terminal backend:
hermes chat -q "Read this image: /path/to/some/image.png"