langchain-ai/deepagents · error · ValueError

`interpreter_ptc` cannot be set to True; use 'safe', 'all',

Error message

`interpreter_ptc` cannot be set to True; use 'safe', 'all', or an explicit list of tool names.

What it means

_parse_interpreter_ptc rejects the boolean True for the interpreter_ptc setting; the setting must be False, the sentinel strings 'safe' or 'all', or an explicit list of tool names. True alone is disallowed because enabling PTC for 'everything' must be an explicit, deliberate choice.

Source

Thrown at libs/code/deepagents_code/config.py:2432

    Returns:
        `False` for `False`/`None`/`[]`, the string `"safe"`/`"all"` when
        either sentinel is given, otherwise a validated list of tool names.
        A list may include the `"safe"` preset (expanded at agent-build time)
        but never `"all"`.

    Raises:
        ValueError: If `raw` is a list with empty or non-string entries, a
            list containing `"all"`, or a string other than `"safe"`/`"all"`.
    """
    if raw is None or raw is False:
        return False
    if raw is True:
        msg = (
            "`interpreter_ptc` cannot be set to True; use 'safe', 'all', or "
            "an explicit list of tool names."
        )
        raise ValueError(msg)
    if isinstance(raw, str):
        normalized = raw.strip().lower()
        if normalized in {INTERPRETER_PTC_SAFE_SENTINEL, INTERPRETER_PTC_ALL_SENTINEL}:
            return normalized
        msg = (
            f"Invalid `interpreter_ptc` string {raw!r}; expected 'safe', 'all', "
            "or a list of tool names."
        )
        raise ValueError(msg)
    if isinstance(raw, list):
        if not raw:
            return False
        names: list[str] = []
        for entry in raw:
            if not isinstance(entry, str) or not entry.strip():
                msg = (
                    "`interpreter_ptc` list entries must be non-empty strings; "
                    f"got {entry!r}."

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Replace true with "all" in your config to enable PTC for every interpreter tool.
  2. Use "safe" if you want the recommended safe preset instead of everything.
  3. List the specific tool names you want enabled if you need fine-grained control.

Example fix

// before (config.toml)
interpreter_ptc = true
// after
interpreter_ptc = "all"
Defensive patterns

Strategy: validation

Validate before calling

raw = cfg.get("interpreter_ptc", False)
if raw is True:
    raw = "all"  # migrate boolean True to 'all' sentinel before parsing

Try / catch

try:
    ptc = _parse_interpreter_ptc(cfg["interpreter_ptc"])
except ValueError as e:
    sys.exit(f"bad config: {e}")

Prevention

When it happens

Trigger: Setting interpreter_ptc = true in the TOML config, or passing True programmatically to the parser via coerce_toml_value.

Common situations: Users converting from a boolean toggle in an older config format without migrating to the 'all' sentinel.

Related errors


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