langchain-ai/deepagents · error · ValueError

interpreter_ptc list entries cannot include 'all'; use…

Error message

interpreter_ptc list entries cannot include 'all'; use 'all' as a standalone value or list explicit tool names (optionally with the 'safe' preset).

What it means

When interpreter_ptc is a list, the library rejects any entry that spells 'all'. 'all' is a standalone sentinel for the whole string form only; embedding it in a list is ambiguous (list entries are otherwise literal tool names, plus the optional 'safe' preset), so it fails fast instead of guessing.

Solutions

  1. If you want everything, use the standalone string: interpreter_ptc="all" (plus interpreter_ptc_acknowledge_unsafe=True or auto_approve=True).
  2. If you want the preset plus extras, use "safe" inside the list: ["safe", "execute"].
  3. Otherwise list only explicit tool names and drop the 'all' entry.

Example fix

// before
create_cli_agent(interpreter_ptc=["safe", "all"])
// after
create_cli_agent(interpreter_ptc="all", interpreter_ptc_acknowledge_unsafe=True)
// or preset + explicit extras
create_cli_agent(interpreter_ptc=["safe", "execute"])
Defensive patterns

Strategy: validation

Validate before calling

if isinstance(ptc, list) and any(str(n).strip().lower() == "all" for n in ptc):
    raise ValueError("use interpreter_ptc='all' as a standalone string, not inside a list")

Type guard

def is_ptc_tool_list(v: object) -> TypeGuard[list[str]]:
    return (
        isinstance(v, list)
        and all(isinstance(n, str) and n.strip().lower() != "all" for n in v)
    )

Try / catch

try:
    agent = create_cli_agent(interpreter_ptc=ptc)
except ValueError as exc:
    if "cannot include 'all'" in str(exc):
        agent = create_cli_agent(interpreter_ptc="all", interpreter_ptc_acknowledge_unsafe=True)
    else:
        raise

Prevention

When it happens

Trigger: create_cli_agent(interpreter_ptc=["all"]) or interpreter_ptc=["safe", "all"] or ["execute", "ALL"] — any list element whose strip().lower() == 'all' raises this ValueError.

Common situations: Users mixing the sentinel vocabulary, e.g. writing ["safe", "all"] intending 'everything plus the preset'; migrating a config that used the string 'all' into list form without realizing 'all' cannot be combined.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at libs/code/deepagents_code/agent.py:1051

                    write_included,
                )
            return included
        msg = (
            f"Invalid interpreter_ptc string {ptc!r}; expected 'safe', 'all', "
            "or a list of tool names."
        )
        raise ValueError(msg)

    if isinstance(ptc, list):
        from deepagents_code.config import INTERPRETER_PTC_SAFE_PRESET

        if any(name.strip().lower() == "all" for name in ptc):
            msg = (
                "interpreter_ptc list entries cannot include 'all'; use 'all' "
                "as a standalone value or list explicit tool names (optionally "
                "with the 'safe' preset)."
            )
            raise ValueError(msg)

        resolved: list[str] = []
        seen: set[str] = set()

        def _add(name: str) -> None:
            if name not in seen:
                seen.add(name)
                resolved.append(name)

        for name in ptc:
            if name.strip().lower() == "safe":
                for member in sorted(INTERPRETER_PTC_SAFE_PRESET):
                    _add(member)
                continue
            _add(name)

        # Explicit names are passed through unvalidated: the middleware resolves
        # them against the live runtime registry (which includes the SDK

View on GitHub (pinned to a1af029e6e)