NousResearch/hermes-agent · error · ValueError

path could not be verified against the credential deny-list

Error message

path could not be verified against the credential deny-list and cannot be attached

What it means

The credential deny-list check itself could not be executed — get_read_block_error raised an unexpected (non-ValueError) exception — so the guard refuses the attachment. This is a deliberate fail-closed design: the gateway feeds untrusted remote text into reference expansion, so if the canonical security lookup fails, allowing the file through could leak operator credentials; a spurious block is recoverable, a leak is not.

Source

Thrown at agent/context_references.py:531

    # protected automatically whenever that deny-list grows.
    try:
        from agent.file_safety import get_read_block_error

        if get_read_block_error(str(path)) is not None:
            raise ValueError(
                "path is a sensitive credential or internal Hermes path and cannot be attached"
            )
    except ValueError:
        raise
    except Exception:
        # Fail CLOSED on the security path. This guard exists specifically to
        # cover credential stores the narrow list above misses (auth.json,
        # .anthropic_oauth.json, mcp-tokens/, ...). If the canonical lookup
        # ever fails, silently falling through would re-open that exact hole —
        # the gateway feeds untrusted remote text here, so a probe could then
        # attach the operator's keys. Refuse instead: a spurious block on a
        # legitimate file is a recoverable annoyance; a leaked credential is not.
        raise ValueError(
            "path could not be verified against the credential deny-list and cannot be attached"
        )


def _strip_trailing_punctuation(value: str) -> str:
    stripped = value.rstrip(TRAILING_PUNCTUATION)
    while stripped.endswith((")", "]", "}")):
        closer = stripped[-1]
        opener = {")": "(", "]": "[", "}": "{"}[closer]
        if stripped.count(closer) > stripped.count(opener):
            stripped = stripped[:-1]
            continue
        break
    return stripped


def _strip_reference_wrappers(value: str) -> str:
    if len(value) >= 2 and value[0] == value[-1] and value[0] in "`\"'":

View on GitHub (pinned to c896c09c42)

Solutions

  1. Treat it as an environment bug: check ~/.hermes/logs/errors.log for the underlying exception.
  2. Verify the installation is intact (reinstall / update Hermes) so agent.file_safety imports cleanly.
  3. Retry once after fixing the environment — a healthy install makes this error disappear.
  4. Report it with the traceback if it persists on a current version.
Defensive patterns

Strategy: try-catch

Try / catch

try:
    attach(path)
except ValueError as e:
    if "could not be verified against the credential deny-list" in str(e):
        # environment/install problem — check errors.log, fix install, retry once
        ...

Prevention

When it happens

Trigger: Any non-ValueError exception thrown inside the get_read_block_error call (import failure of agent.file_safety, filesystem error during deny-list evaluation, unexpected TypeError). The except Exception branch converts it into this refusal.

Common situations: A broken/partial Hermes installation where agent.file_safety cannot be imported; corrupted deny-list state; exotic filesystem errors on the referenced path. Rare in practice — usually indicates an environment problem worth investigating.

Related errors


AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14). Data as JSON: /api/errors/108f0482b45b9596. Report an issue: GitHub.