NousResearch/hermes-agent · error · ValueError

Plugin LLM structured output did not match schema

Error message

Plugin LLM structured output did not match schema: {exc.message}

What it means

Error "Plugin LLM structured output did not match schema: {exc.message}" thrown in NousResearch/hermes-agent.

Solutions

  1. Adjust the plugin's schema or prompt so the model output validates.
  2. Review the schema validation error and fix the field mismatch.
  3. Retry; structured output can fail intermittently on borderline prompts.

When it happens

Trigger: Thrown at agent/plugin_llm.py:591 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/6a859cb02fe4c6d5. Report an issue: GitHub.

Appendix: source

Thrown at agent/plugin_llm.py:591

    if not (json_mode or json_schema is not None):
        return None, "text"
    if not text:
        return None, "text"

    try:
        parsed = json.loads(_strip_code_fences(text))
    except (json.JSONDecodeError, ValueError):
        return None, "text"

    if json_schema is not None:
        try:
            import jsonschema  # type: ignore[import-untyped]
            jsonschema.validate(parsed, json_schema)
        except ImportError:
            # jsonschema is optional; skip strict validation when absent.
            logger.debug("jsonschema unavailable; skipping schema validation")
        except jsonschema.ValidationError as exc:  # type: ignore[attr-defined]
            raise ValueError(
                f"Plugin LLM structured output did not match schema: {exc.message}"
            ) from exc

    return parsed, "json"


# ---------------------------------------------------------------------------
# Usage extraction
# ---------------------------------------------------------------------------


def _extract_usage(response: Any) -> PluginLlmUsage:
    """Pull token usage out of an OpenAI-shaped response object.

    Tolerant of provider differences — Anthropic via the auxiliary
    adapter exposes ``usage.prompt_tokens`` / ``usage.completion_tokens``;
    direct OpenAI also exposes ``cache_read_input_tokens``."""
    usage = PluginLlmUsage()

View on GitHub (pinned to c896c09c42)