NousResearch/hermes-agent · error · ValueError
Codex Responses input[{idx}].content[{part_idx}] must be an
Error message
Codex Responses input[{idx}].content[{part_idx}] must be an object or string. What it means
Error "Codex Responses input[{idx}].content[{part_idx}] must be an object or string." thrown in NousResearch/hermes-agent.
Source
Thrown at agent/codex_responses_adapter.py:913
if role in {"user", "assistant"}:
content = item.get("content", "")
if content is None:
content = ""
if isinstance(content, list):
# Multimodal content from ``_chat_messages_to_responses_input``
# is already in Responses format (``input_text`` / ``output_text``
# / ``input_image``). Validate each part and pass through.
# Use the correct text type for the role — ``output_text`` for
# assistant messages, ``input_text`` for user messages.
text_type = "output_text" if role == "assistant" else "input_text"
validated: List[Dict[str, Any]] = []
for part_idx, part in enumerate(content):
if isinstance(part, str):
if part:
validated.append({"type": text_type, "text": sanitize_text(part)})
continue
if not isinstance(part, dict):
raise ValueError(
f"Codex Responses input[{idx}].content[{part_idx}] must be an object or string."
)
ptype = str(part.get("type") or "").strip().lower()
if ptype in {"input_text", "text", "output_text"}:
text = part.get("text", "")
if not isinstance(text, str):
text = str(text or "")
validated.append({"type": text_type, "text": sanitize_text(text)})
elif ptype in {"input_image", "image_url"}:
image_ref = part.get("image_url", "")
detail = part.get("detail")
if isinstance(image_ref, dict):
url = image_ref.get("url", "")
detail = image_ref.get("detail", detail)
else:
url = image_ref
if not isinstance(url, str):
url = str(url or "")View on GitHub (pinned to c896c09c42)
Solutions
- Emit content parts as objects or strings only.
- Fix the conversion that produced a non-object, non-string content part.
When it happens
Trigger: Thrown at agent/codex_responses_adapter.py:913 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14).
Data as JSON: /api/errors/00ac4d92ffe446ff.
Report an issue: GitHub.