langchain-ai/deepagents · error · ValueError

Unsupported hooks trust store version: {version!r}

Error message

Unsupported hooks trust store version: {version!r}

What it means

The trust store carries a version field; when it doesn't match the library's _STORE_VERSION, _load_store raises ValueError in strict mode (and warns + returns an empty store otherwise). This prevents misinterpreting trust entries written by an incompatible store format.

Source

Thrown at libs/code/deepagents_code/hooks/trust.py:198

        data: object = json.loads(raw_text)
    except json.JSONDecodeError as exc:
        if strict:
            raise
        logger.warning("Could not parse hooks trust store %s: %s", path, exc)
        return HooksTrustStore()

    if not isinstance(data, dict):
        msg = f"hooks trust store must be a JSON object: {path}"
        if strict:
            raise TypeError(msg)
        logger.warning(msg)
        return HooksTrustStore()

    version = data.get("version")
    if version != _STORE_VERSION:
        msg = f"Unsupported hooks trust store version: {version!r}"
        if strict:
            raise ValueError(msg)
        logger.warning(
            "Ignoring hooks trust store with unsupported version %r", version
        )
        return HooksTrustStore()

    try:
        projects = _parse_projects(data.get("projects"), path=path)
    except TypeError:
        if strict:
            raise
        logger.warning(
            "Ignoring hooks trust store with invalid projects field at %s",
            path,
        )
        return HooksTrustStore()

    # Tolerate unknown top-level fields via HooksTrustStore.extra="ignore".
    return HooksTrustStore(version=_STORE_VERSION, projects=projects)

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Recreate the store at the current version: delete the file and re-approve trust for each project.
  2. If migrating forward, upgrade the library version that matches the store, or re-trust projects to rewrite the store.
  3. Don't hand-edit the version field; let the library manage it.
  4. Use strict=False to ignore incompatible stores (with warning) when trust checks are advisory.

Example fix

// before
{"version": 99, "projects": {"/repo/a": {...}}}  # ValueError in strict mode

// after
rm ~/.config/deepagents/hooks_trust.json
# then re-run trust flow:
trust_project_hooks("/repo/a")
Defensive patterns

Strategy: fallback

Validate before calling

data = json.loads(store_path.read_text())
if isinstance(data, dict) and data.get("version") != CURRENT_STORE_VERSION:
    migrate_or_reset_store(store_path)

Type guard

def is_current_version(data: object) -> TypeGuard[dict]:
    return isinstance(data, dict) and data.get("version") == CURRENT_STORE_VERSION

Try / catch

try:
    store = load_hooks_trust_store(path, strict=True)
except ValueError as exc:
    if "Unsupported hooks trust store version" in str(exc):
        reset_store_and_retrust(path)  # recreate at current version

Prevention

When it happens

Trigger: Loading a trust store written by a different deepagents version whose "version" value differs from the current _STORE_VERSION — e.g. downgrading the tool, sharing a store across machines with different versions, or editing version by hand.

Common situations: Rolling back to an older release that used a different store version; copying a trust store from another environment; manually incrementing version in the JSON.

Related errors


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/2fedcc7de40f977f. Report an issue: GitHub.