langchain-ai/deepagents · error · ValueError

Cannot combine 'all' with other commands in --shell-allow-li

Error message

Cannot combine 'all' with other commands in --shell-allow-list. Use '--shell-allow-list all' alone to allow any command.

What it means

parse_shell_allow_list_items validates the --shell-allow-list input; the special value 'all' permits every shell command but is ambiguous when mixed with specific commands, so it is rejected unless it is the sole item. This forces an explicit, unambiguous security posture.

Source

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

        entry, or `None` if every entry was blank.

    Raises:
        ValueError: If `'all'` is combined with other commands.
    """
    commands = [item.strip() for item in items if item.strip()]
    if not commands:
        return None

    if len(commands) == 1 and commands[0].lower() == "all":
        return SHELL_ALLOW_ALL

    # Reject ambiguous input: 'all' mixed with other commands
    if any(cmd.lower() == "all" for cmd in commands):
        msg = (
            "Cannot combine 'all' with other commands in --shell-allow-list. "
            "Use '--shell-allow-list all' alone to allow any command."
        )
        raise ValueError(msg)

    # If "recommended" is in the list, merge with recommended commands
    result = []
    for cmd in commands:
        if cmd.lower() == "recommended":
            result.extend(RECOMMENDED_SAFE_SHELL_COMMANDS)
        else:
            result.append(cmd)

    # Remove duplicates while preserving order
    seen: set[str] = set()
    unique: list[str] = []
    for cmd in result:
        if cmd not in seen:
            seen.add(cmd)
            unique.append(cmd)
    return unique

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Use --shell-allow-list all alone (no other entries) to allow any command.
  2. Remove 'all' from the list and keep only the explicit commands you want to permit.
  3. If you meant 'recommended plus extras', drop 'all' and list 'recommended' alongside the additional commands.

Example fix

// before
shell_allow_list = ["all", "ls"]
// after
shell_allow_list = ["all"]  # or
shell_allow_list = ["ls"]
Defensive patterns

Strategy: validation

Validate before calling

cmds = [c.strip() for c in raw.split(",") if c.strip()]
if "all" in (c.lower() for c in cmds) and len(cmds) > 1:
    raise ValueError("'all' must be the only item in shell-allow-list")

Try / catch

try:
    allowed = parse_shell_allow_list(raw)
except ValueError as e:
    sys.exit(f"invalid --shell-allow-list: {e}")

Prevention

When it happens

Trigger: Passing --shell-allow-list 'all,ls' or a TOML shell_allow_list = ["all", "git"] — any list containing 'all' (case-insensitive) plus at least one other entry.

Common situations: Extending a default list by appending 'all' intending to broaden it, scripting config generation that concatenates 'all' with existing entries, or a user misunderstanding 'all' as a command name.

Related errors


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