crewAIInc/crewAI · error · ValueError
action='exists' requires 'path'
Error message
action='exists' requires 'path'
What it means
For action='exists' DaytonaFileTool._run needs a 'path' to test existence via self._exists(sandbox, path). With path=None it raises ValueError immediately; the sandbox is never contacted. This check runs before any I/O, so catching it early costs nothing.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/daytona_sandbox_tool/daytona_file_tool.py:288
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:
raise ValueError("action='move' requires 'path' and 'destination'")
sandbox.fs.move_files(path, destination)
return {"status": "moved", "from": path, "to": destination}
if action == "find":
if path is None or pattern is None:
raise ValueError("action='find' requires 'path' and 'pattern'")
return self._find(sandbox, path, pattern)
if action == "search":
if path is None or pattern is None:
raise ValueError("action='search' requires 'path' and 'pattern'")
return self._search(sandbox, path, pattern)
if action == "chmod":
if path is None:
raise ValueError("action='chmod' requires 'path'")
return self._chmod(sandbox, path, mode=mode, owner=owner, group=group)View on GitHub (pinned to 754d7323be)
Solutions
- Pass the target explicitly: _run(action='exists', path='/workspace/in.txt').
- Add a pre-call guard in your orchestrator that rejects action='exists' without a path.
- Fix the agent prompt/tool description so existence checks always carry the full path.
Example fix
# before file_tool._run(action='exists') # after file_tool._run(action='exists', path='/workspace/inputs/data.csv')
Defensive patterns
Strategy: validation
Validate before calling
def file_exists(file_tool, path: str) -> bool:
if not path or not isinstance(path, str):
raise ValueError("path must be a non-empty string for action='exists'")
return bool(file_tool._run(action='exists', path=path).get('exists')) Type guard
def is_nonempty_path(value: object) -> bool:
return isinstance(value, str) and bool(value.strip()) Try / catch
try:
result = file_tool._run(action='exists', path=path)
except ValueError as e:
if "requires 'path'" in str(e):
return False # cannot probe without a target; treat as unknown
raise Prevention
- Type-annotate wrappers so None cannot reach the tool.
- Validate agent-emitted JSON against a schema before dispatch.
- Default missing paths to a known workspace root instead of None.
When it happens
Trigger: Calling _run(action='exists') without path; an agent probing 'does the file exist?' but forgetting to include the filename; passing the path inside a nested dict instead of as the top-level 'path' kwarg.
Common situations: Agents that phrase existence checks in natural language and the tool-call formatter drops the path; testing the tool with a bare action string.
Related errors
- action='delete' requires 'path'
- action='mkdir' requires 'path'
- action='info' 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/26c8f995f25abe54.
Report an issue: GitHub.