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
- Use --shell-allow-list all alone (no other entries) to allow any command.
- Remove 'all' from the list and keep only the explicit commands you want to permit.
- 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
- Treat 'all' as a mode, not a list entry: either 'all' alone or explicit commands
- Deduplicate and lowercase list entries before validation
- Prefer explicit command lists over 'all' for security
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
- `interpreter_ptc` list entries cannot include 'all'; use 'al
- modes can only be provided when agent is a factory
- models can only be provided when agent is a factory
- -32602
- allow_fs_tools must be None or a non-empty list
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/b48bca73b804ff3c.
Report an issue: GitHub.