NousResearch/hermes-agent · error · ValueError

key too long (max {MAX_KEY_CHARS} characters)

Error message

key too long (max {MAX_KEY_CHARS} characters)

What it means

Error "key too long (max {MAX_KEY_CHARS} characters)" thrown in NousResearch/hermes-agent.

Source

Thrown at cron/notepad.py:87

    leaking it.
    """
    with _lock:
        conn = _connect()
        try:
            _initialize_schema(conn)
            with conn:
                yield conn
        finally:
            conn.close()


def _validate(job_id: str, key: str, value: str) -> None:
    if not str(job_id):
        raise ValueError("job_id must be non-empty")
    if not key:
        raise ValueError("key must be non-empty")
    if len(key) > MAX_KEY_CHARS:
        raise ValueError(f"key too long (max {MAX_KEY_CHARS} characters)")
    if len(value.encode("utf-8")) > MAX_VALUE_BYTES:
        raise ValueError(
            f"value too large (max {MAX_VALUE_BYTES} bytes per key)"
        )


def set_note(job_id: str, key: str, value: str) -> Dict[str, Any]:
    """Upsert one key. Raises ValueError when a size cap would be exceeded."""
    job_id, key, value = str(job_id), str(key), str(value)
    _validate(job_id, key, value)
    now = _hermes_now().isoformat()
    with _transaction() as conn:
        row = conn.execute(
            """SELECT COALESCE(SUM(LENGTH(CAST(key AS BLOB))
                 + LENGTH(CAST(value AS BLOB))), 0)
               FROM cron_notepad WHERE job_id=? AND key<>?""",
            (job_id, key),
        ).fetchone()

View on GitHub (pinned to c896c09c42)

Solutions

  1. Shorten the notepad key to the allowed maximum length.

When it happens

Trigger: Thrown at cron/notepad.py:87 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/4c0b48b14ce05338. Report an issue: GitHub.