{"record":{"id":"6a859cb02fe4c6d5","repo":"NousResearch/hermes-agent","slug":"plugin-llm-structured-output-did-not-match-schema","errorCode":null,"errorMessage":"Plugin LLM structured output did not match schema: {exc.message}","messagePattern":"Plugin LLM structured output did not match schema: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/plugin_llm.py","lineNumber":591,"sourceCode":"    if not (json_mode or json_schema is not None):\n        return None, \"text\"\n    if not text:\n        return None, \"text\"\n\n    try:\n        parsed = json.loads(_strip_code_fences(text))\n    except (json.JSONDecodeError, ValueError):\n        return None, \"text\"\n\n    if json_schema is not None:\n        try:\n            import jsonschema  # type: ignore[import-untyped]\n            jsonschema.validate(parsed, json_schema)\n        except ImportError:\n            # jsonschema is optional; skip strict validation when absent.\n            logger.debug(\"jsonschema unavailable; skipping schema validation\")\n        except jsonschema.ValidationError as exc:  # type: ignore[attr-defined]\n            raise ValueError(\n                f\"Plugin LLM structured output did not match schema: {exc.message}\"\n            ) from exc\n\n    return parsed, \"json\"\n\n\n# ---------------------------------------------------------------------------\n# Usage extraction\n# ---------------------------------------------------------------------------\n\n\ndef _extract_usage(response: Any) -> PluginLlmUsage:\n    \"\"\"Pull token usage out of an OpenAI-shaped response object.\n\n    Tolerant of provider differences — Anthropic via the auxiliary\n    adapter exposes ``usage.prompt_tokens`` / ``usage.completion_tokens``;\n    direct OpenAI also exposes ``cache_read_input_tokens``.\"\"\"\n    usage = PluginLlmUsage()","sourceCodeStart":573,"sourceCodeEnd":609,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/agent/plugin_llm.py#L573-L609","documentation":"Error \"Plugin LLM structured output did not match schema: {exc.message}\" thrown in NousResearch/hermes-agent.","triggerScenarios":"Thrown at agent/plugin_llm.py:591 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Adjust the plugin's schema or prompt so the model output validates.","Review the schema validation error and fix the field mismatch.","Retry; structured output can fail intermittently on borderline prompts."],"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-15T17:31:12.345Z"}