{"record":{"id":"ee9531b41891fa74","repo":"NousResearch/hermes-agent","slug":"image-input-data-must-be-bytes","errorCode":null,"errorMessage":"image input 'data' must be bytes","messagePattern":"image input 'data' must be bytes","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/plugin_llm.py","lineNumber":538,"sourceCode":"        except (TypeError, ValueError):\n            schema_text = str(json_schema)\n        header = f\"{header}\\n\\nJSON schema:\\n{schema_text}\"\n    user_parts.append({\"type\": \"text\", \"text\": header})\n\n    for block in inputs:\n        norm = _normalize_input_block(block)\n        if norm[\"type\"] == \"text\":\n            user_parts.append({\"type\": \"text\", \"text\": norm[\"text\"]})\n        elif norm[\"type\"] == \"image\":\n            if norm.get(\"url\"):\n                user_parts.append({\n                    \"type\": \"image_url\",\n                    \"image_url\": {\"url\": norm[\"url\"]},\n                })\n            else:\n                data = norm.get(\"data\") or b\"\"\n                if not isinstance(data, (bytes, bytearray)):\n                    raise ValueError(\"image input 'data' must be bytes\")\n                b64 = base64.b64encode(data).decode(\"ascii\")\n                mime = norm.get(\"mime_type\") or \"image/png\"\n                user_parts.append({\n                    \"type\": \"image_url\",\n                    \"image_url\": {\"url\": f\"data:{mime};base64,{b64}\"},\n                })\n\n    messages.append({\"role\": \"user\", \"content\": user_parts})\n    return messages\n\n\n# ---------------------------------------------------------------------------\n# JSON parsing\n# ---------------------------------------------------------------------------\n\n\n_FENCE_RE = re.compile(r\"```(?:json)?\\s*(.+?)```\", re.DOTALL | re.IGNORECASE)\n","sourceCodeStart":520,"sourceCodeEnd":556,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/agent/plugin_llm.py#L520-L556","documentation":"Error \"image input 'data' must be bytes\" thrown in NousResearch/hermes-agent.","triggerScenarios":"Thrown at agent/plugin_llm.py:538 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass image 'data' as bytes, not a string or other type.","Encode the image correctly in the plugin before building the block."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}