langchain-ai/deepagents · error · ManagedConfigError

ManagedConfigError(provider.status)

Error message

ManagedConfigError(provider.status)

What it means

_raise_for_managed_provider converts an unusable ranked provider status into a ManagedConfigError. When a provider's status is not usable (e.g. the backing config file is unreadable or missing), the library raises ManagedConfigError carrying the original ProviderStatus so callers can see which config source failed and why.

Source

Thrown at libs/code/deepagents_code/mcp_disabled.py:286


def _raise_for_managed_provider(
    provider: RankedProviderValue[list[str]],
) -> None:
    """Apply the deny-list callsite's fail-closed health policy.

    Raises:
        ManagedConfigError: If the provider is unhealthy or its value is invalid.
    """
    from deepagents_code.configuration.service import ManagedConfigError
    from deepagents_code.configuration.types import (
        Invalid,
        ProviderHealth,
        ProviderStatus,
    )

    if not provider.status.usable:
        raise ManagedConfigError(provider.status)
    if isinstance(provider.result, Invalid):
        raise ManagedConfigError(
            ProviderStatus(
                provider.status.name,
                provider.status.path,
                ProviderHealth.CORRUPT,
                provider.result.reason,
            )
        )


def _disabled_entries(data: dict[str, Any]) -> set[str]:
    """Return disabled names from the current config shape with legacy fallback."""
    section = data.get(_SECTION)
    if isinstance(section, dict):
        entries = _coerce_entries(section.get(_KEY))
        if entries is not None:
            return entries

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Inspect the ManagedConfigError's embedded ProviderStatus (name, path, health) to find the failing config file.
  2. Fix the file at that path: restore read permissions, restore the missing file, or delete/recreate it.
  3. If the file is disposable (e.g. a cache of disabled servers), remove it and re-run; the library will recreate defaults.
  4. Re-run `dcode mcp` commands to confirm resolution succeeds.

Example fix

# before
ls -l ~/.config/dcode/config.toml  # -rw------- root:root, running as non-root
# after
sudo chown $USER ~/.config/dcode/config.toml && chmod 600 ~/.config/dcode/config.toml
Defensive patterns

Strategy: try-catch

Validate before calling

from pathlib import Path
p = Path(config_path)
if not p.exists() or not p.is_file():
    print(f"config missing/unusable: {p}")
else:
    p.read_text()  # raises PermissionError early if unreadable

Try / catch

try:
    disabled = get_disabled_servers()
except ManagedConfigError as exc:
    status = exc.status
    print(f"config source {status.name} at {status.path} unusable: {status.health}")

Prevention

When it happens

Trigger: Calling get_disabled_servers when one of the ranked config providers reports status.usable == False — e.g. the config file at the provider's path cannot be loaded/parsed at all.

Common situations: A global or project config file has bad permissions, is locked by another process, or the file path no longer exists; a corrupt config file fails to load.

Related errors


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