crewAIInc/crewAI · error · ValueError
action='find' requires 'path' and 'pattern'
Error message
action='find' requires 'path' and 'pattern'
What it means
action='find' in DaytonaFileTool._run requires 'path' (search root) and 'pattern' (glob), and raises ValueError if either is None before delegating to self._find. Both arguments are checked together with one condition. No sandbox I/O happens when the check fails.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/daytona_sandbox_tool/daytona_file_tool.py:297
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)
if action == "replace":
if paths is None or pattern is None or replacement is None:
raise ValueError(
"action='replace' requires 'paths', 'pattern', and "
"'replacement'"
)
return self._replace(sandbox, paths, pattern, replacement)
raise ValueError(f"Unknown action: {action}")
finally:View on GitHub (pinned to 754d7323be)
Solutions
- Pass both: _run(action='find', path='/workspace', pattern='**/*.log').
- Pre-check kwargs: if action == 'find', require path and pattern keys.
- In agent prompts, require an explicit search root and glob for every find step.
Example fix
# before file_tool._run(action='find', pattern='*.log') # after file_tool._run(action='find', path='/var/log', pattern='**/*.log')
Defensive patterns
Strategy: validation
Validate before calling
def find_files(file_tool, root: str | None, pattern: str | None):
if not root or not pattern:
raise ValueError("action='find' requires 'path' and 'pattern'")
return file_tool._run(action='find', path=root, pattern=pattern) Try / catch
try:
res = file_tool._run(action='find', path=root, pattern=pattern)
except ValueError as e:
if 'find' in str(e):
pattern = pattern or '**/*' # safe default, retry once
res = file_tool._run(action='find', path=root, pattern=pattern)
else:
raise Prevention
- Default the pattern to '**/*' in your wrapper when the caller only gives a root.
- Validate agent tool JSON with pydantic before execution.
- Document the difference between find (glob) and search (content) in prompts.
When it happens
Trigger: Calling _run(action='find', path='/workspace') with no pattern, or _run(action='find', pattern='*.py') with no root; agents that say 'find python files' and omit the directory.
Common situations: Agents assuming a default root (e.g. current directory); users confusing pattern (glob for filenames) with the search action's pattern (file content regex); partial JSON tool calls.
Related errors
- action='delete' requires 'path'
- action='mkdir' requires 'path'
- action='info' requires 'path'
- action='exists' requires 'path'
- action='move' requires 'path' and 'destination'
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/1b8afd3105745981.
Report an issue: GitHub.