NousResearch/hermes-agent · error · ValueError

Codex Responses input[{idx}] message items must have role='a

Error message

Codex Responses input[{idx}] message items must have role='assistant'.

What it means

Error "Codex Responses input[{idx}] message items must have role='assistant'." thrown in NousResearch/hermes-agent.

Source

Thrown at agent/codex_responses_adapter.py:850

                    reasoning_item["summary"] = []
                normalized.append(reasoning_item)
            continue

        if item_type == "compaction":
            # Replayed native server-side compaction checkpoint (gpt-5.6,
            # direct OpenAI/Codex routes). Opaque, issuer-sealed; forward
            # only the fields the API defines.
            encrypted = item.get("encrypted_content")
            if isinstance(encrypted, str) and encrypted:
                normalized.append(
                    {"type": "compaction", "encrypted_content": encrypted}
                )
            continue

        if item_type == "message":
            role = item.get("role")
            if role != "assistant":
                raise ValueError(f"Codex Responses input[{idx}] message items must have role='assistant'.")
            content = item.get("content")
            if not isinstance(content, list):
                raise ValueError(f"Codex Responses input[{idx}] message item must have content list.")
            normalized_content = []
            for part_idx, part in enumerate(content):
                if not isinstance(part, dict):
                    raise ValueError(
                        f"Codex Responses input[{idx}] message content[{part_idx}] must be an object."
                    )
                part_type = part.get("type")
                if part_type not in {"output_text", "text"}:
                    raise ValueError(
                        f"Codex Responses input[{idx}] message content[{part_idx}] has unsupported type {part_type!r}."
                    )
                text = part.get("text", "")
                if text is None:
                    text = ""
                if not isinstance(text, str):

View on GitHub (pinned to c896c09c42)

Solutions

  1. Convert non-assistant message items to the correct Responses input shape.
  2. Only message items with role='assistant' are valid in this position.

When it happens

Trigger: Thrown at agent/codex_responses_adapter.py:850 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/a16c15199fb2bb75. Report an issue: GitHub.