crewAIInc/crewAI · error · ValueError
action='delete' requires 'path'
Error message
action='delete' requires 'path'
What it means
DaytonaFileTool._run dispatches on an 'action' string and every action requires certain arguments. For action='delete' the tool requires a 'path' argument naming the sandbox file or folder to remove; when path is None it raises ValueError before touching the sandbox. This is a client-side argument validation error, not a Daytona SDK failure. The sandbox is released cleanly in the finally block, so no resources leak.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/daytona_sandbox_tool/daytona_file_tool.py:273
if action == "read":
if path is None:
raise ValueError("action='read' requires 'path'")
return self._read(sandbox, path, binary=binary)
if action == "write":
if path is None:
raise ValueError("action='write' requires 'path'")
return self._write(sandbox, path, content or "", binary=binary)
if action == "append":
if path is None:
raise ValueError("action='append' requires 'path'")
return self._append(sandbox, path, content or "", binary=binary)
if action == "list":
if path is None:
raise ValueError("action='list' requires 'path'")
return self._list(sandbox, path)
if action == "delete":
if path is None:
raise ValueError("action='delete' requires 'path'")
sandbox.fs.delete_file(path, recursive=recursive)
return {"status": "deleted", "path": path}
if action == "mkdir":
if path is None:
raise ValueError("action='mkdir' requires 'path'")
mkdir_mode = mode or "0755"
sandbox.fs.create_folder(path, mkdir_mode)
return {"status": "created", "path": path, "mode": mkdir_mode}
if action == "info":
if path is None:
raise ValueError("action='info' requires 'path'")
return self._info(sandbox, path)
if action == "exists":
if path is None:
raise ValueError("action='exists' requires 'path'")
return self._exists(sandbox, path)
if action == "move":
if path is None or destination is None:View on GitHub (pinned to 754d7323be)
Solutions
- Pass a non-None path, e.g. _run(action='delete', path='/tmp/old.log', recursive=True).
- Check the tool's args_schema (Daytona File Tool schema) for required kwargs per action before invoking.
- If an agent is generating the call, add an explicit instruction in the tool description that every action except 'create' requires 'path'.
- Pre-validate the kwargs dict in your own wrapper before calling the tool.
Example fix
# before result = file_tool._run(action='delete') # after result = file_tool._run(action='delete', path='/workspace/staging/out.txt')
Defensive patterns
Strategy: validation
Validate before calling
def validate_file_tool_kwargs(action: str, kwargs: dict) -> None:
required = {
'delete': ['path'], 'mkdir': ['path'], 'info': ['path'],
'exists': ['path'], 'move': ['path', 'destination'],
'chmod': ['path'],
}
for key in required.get(action, []):
if kwargs.get(key) is None:
raise ValueError(f"action='{action}' requires '{key}'") Try / catch
try:
result = file_tool._run(**kwargs)
except ValueError as e:
if 'requires' in str(e):
log_and_repair_agent_call(str(e), kwargs) # ask caller/agent to supply missing args
else:
raise Prevention
- Build tool calls from the tool's args_schema rather than hand-written dicts.
- Keep an allowlist of required-argument sets per action and check before invoking.
- In agent prompts, state that every Daytona action except 'create' requires 'path'.
When it happens
Trigger: Calling DaytonaFileTool._run(action='delete') without a path kwarg, or with path=None (e.g. an LLM agent emitting only {"action": "delete"}). Also passing the target under a different key such as 'file', 'target', or 'destination'.
Common situations: LLM-driven agents that format the tool call from natural language and omit the path; refactors that renamed the argument; copy-pasting an example for a different action (delete uses path, not destination).
Related errors
- action='mkdir' requires 'path'
- action='info' requires 'path'
- action='exists' requires 'path'
- action='move' requires 'path' and 'destination'
- action='find' requires 'path' and 'pattern'
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/561cc177f8643847.
Report an issue: GitHub.