{"record":{"id":"bdce578e402c0e00","repo":"NousResearch/hermes-agent","slug":"reserved-harmony-tokens-in-a-json-object-key-canno","errorCode":null,"errorMessage":"Reserved Harmony tokens in a JSON object key cannot be neutralized without changing its contract.","messagePattern":"Reserved Harmony tokens in a JSON object key cannot be neutralized without changing its contract\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/codex_responses_adapter.py","lineNumber":141,"sourceCode":"    result.append(text[original_cursor:])\n    return \"\".join(result)\n\n\ndef _neutralize_harmony_structure(value: Any) -> Any:\n    \"\"\"Neutralize JSON-like values; normalize tuples and reject unsafe keys.\n\n    Rewriting an object key could desynchronize a tool schema from the executor\n    contract, so a reserved token there is rejected explicitly instead.\n    \"\"\"\n    if isinstance(value, str):\n        return _neutralize_harmony_tokens(value)\n    if isinstance(value, (list, tuple)):\n        return [_neutralize_harmony_structure(item) for item in value]\n    if isinstance(value, dict):\n        normalized = {}\n        for key, item in value.items():\n            if isinstance(key, str) and _neutralize_harmony_tokens(key) != key:\n                raise ValueError(\n                    \"Reserved Harmony tokens in a JSON object key cannot be \"\n                    \"neutralized without changing its contract.\"\n                )\n            normalized[key] = _neutralize_harmony_structure(item)\n        return normalized\n    return value\n\n\n# ---------------------------------------------------------------------------\n# Multimodal content helpers\n# ---------------------------------------------------------------------------\n\ndef _chat_content_to_responses_parts(content: Any, *, role: str = \"user\") -> List[Dict[str, Any]]:\n    \"\"\"Convert chat-style multimodal content to Responses API input parts.\n\n    Input:  ``[{\"type\":\"text\"|\"image_url\", ...}]`` (native OpenAI Chat format)\n    Output: ``[{\"type\":\"input_text\"|\"output_text\"|\"input_image\", ...}]`` (Responses format)\n","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/agent/codex_responses_adapter.py#L123-L159","documentation":"Error \"Reserved Harmony tokens in a JSON object key cannot be neutralized without changing its contract.\" thrown in NousResearch/hermes-agent.","triggerScenarios":"Thrown at agent/codex_responses_adapter.py:141 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename the JSON object key so it does not collide with reserved Harmony tokens.","Restructure the payload so reserved tokens never appear as keys."],"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"}