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

  1. Pass a non-None path, e.g. _run(action='delete', path='/tmp/old.log', recursive=True).
  2. Check the tool's args_schema (Daytona File Tool schema) for required kwargs per action before invoking.
  3. If an agent is generating the call, add an explicit instruction in the tool description that every action except 'create' requires 'path'.
  4. 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

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


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/561cc177f8643847. Report an issue: GitHub.