langchain-ai/deepagents · error · RuntimeError

shared config resolver has no managed TOML provider

Error message

shared config resolver has no managed TOML provider

What it means

_managed_replacement_provider builds a managed-tier replacement for an existing resolver, which presupposes a managed TOML provider already occupies MANAGED_RANK. If `resolver.toml_snapshot(MANAGED_RANK)` returns None — no managed provider is installed on this resolver — it raises RuntimeError, since replacing a tier that does not exist is a programming error, not a config problem.

Source

Thrown at libs/code/deepagents_code/configuration/resolver.py:669

    Args:
        resolver: Resolver currently serving the previous generation.
        candidate: Snapshot fetched before taking the resolver lock. A newer
            enforceable generation may have published while this caller waited.

    Returns:
        Replacement carrying the current enforceable generation or the
        candidate's failed-refresh status.

    Raises:
        RuntimeError: If the shared resolver has no managed TOML provider.
    """
    from deepagents_code.configuration.providers import TomlFileProvider
    from deepagents_code.configuration.service import get_managed_snapshot

    installed = resolver.toml_snapshot(MANAGED_RANK)
    if installed is None:
        msg = "shared config resolver has no managed TOML provider"
        raise RuntimeError(msg)
    if candidate.status.usable:
        candidate = get_managed_snapshot()
    replacement = TomlFileProvider(
        name=candidate.status.name,
        path=candidate.status.path,
        rank=MANAGED_RANK,
        durable=True,
        snapshot=installed,
        loader=_reload_enforceable_managed_snapshot,
    )
    replacement.reload_from_snapshot(candidate)
    return replacement


def install_cli_provider(cli_provider: ConfigProvider) -> None:
    """Install the process CLI provider without touching config files.

    Unlike `get_config_resolver(cli_provider=...)`, this never imports

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Build the resolver with a managed TOML provider at MANAGED_RANK (use the standard get_config_resolver construction path).
  2. In tests, include a managed provider fixture (even pointing at an empty/missing file) before testing refresh_managed behavior.
  3. Guard refresh logic: check `resolver.toml_snapshot(MANAGED_RANK) is not None` before requesting a managed replacement.

Example fix

// before: resolver built without a managed tier, then refreshed
resolver = make_resolver(user=user_snap)  # no managed provider
resolver.reload_with_replacements({MANAGED_RANK: _managed_replacement_provider(resolver, snap)})
// RuntimeError
// after: construct with the managed tier from the start
resolver = make_resolver(managed=managed_snap, user=user_snap)
Defensive patterns

Strategy: validation

Validate before calling

if resolver.toml_snapshot(MANAGED_RANK) is None:
    raise RuntimeError(
        "Refusing managed refresh: this resolver has no managed TOML provider; "
        "rebuild it via get_config_resolver()."
    )

Try / catch

try:
    resolver = get_config_resolver(refresh_managed=True)
except RuntimeError as exc:
    if "no managed TOML provider" in str(exc):
        resolver = rebuild_standard_resolver()  # include managed tier
    else:
        raise

Prevention

When it happens

Trigger: Calling `get_config_resolver(refresh_managed=True)` (which routes through _managed_replacement_provider via reload_with_replacements) on a resolver instance that was built without a managed TOML provider at MANAGED_RANK — typically a hand-constructed resolver from `resolver_from_snapshots`-style helpers or tests that omitted the managed tier.

Common situations: Tests creating resolvers with only user/CLI tiers and then invoking the managed-refresh path; custom tooling reusing internal resolver APIs with a pruned provider set; a code path where managed installation was skipped but a managed refresh was later requested.

Related errors


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