diff --git a/autogpt_platform/backend/backend/blocks/claude_code.py b/autogpt_platform/backend/backend/blocks/claude_code.py index c9bb9aa0de..12b7ac349b 100644 --- a/autogpt_platform/backend/backend/blocks/claude_code.py +++ b/autogpt_platform/backend/backend/blocks/claude_code.py @@ -651,10 +651,11 @@ class ClaudeCodeBlock(Block): pass elif is_binary: try: - # Read binary file as bytes - content_bytes = await sandbox.files.read(file_path) - if isinstance(content_bytes, str): - content_bytes = content_bytes.encode("utf-8") + # Read binary file as bytes using format="bytes" + # This returns bytearray, avoiding UTF-8 decoding issues + content_bytes = await sandbox.files.read( + file_path, format="bytes" + ) # Base64 encode the binary content content_b64 = base64.b64encode(content_bytes).decode(