crewAIInc/crewAI · error · ValueError

action='list' requires 'path'

Error message

action='list' requires 'path'

What it means

DaytonaFileTool._run's defensive check for action='list': a None path raises ValueError before self._list(sandbox, path) is called. The Pydantic schema normally rejects a missing path earlier, so this fires mainly on direct _run invocations. Note that listing requires an explicit directory path — there is no implicit root default.

Source

Thrown at lib/crewai-tools/src/crewai_tools/tools/daytona_sandbox_tool/daytona_file_tool.py:269

        group: str | None = None,
    ) -> Any:
        sandbox, should_delete = self._acquire_sandbox()
        try:
            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:

View on GitHub (pinned to 754d7323be)

Solutions

  1. Pass the directory explicitly: tool.run(action='list', path='/workspace').
  2. Do not rely on a default root — always provide the directory to list.
  3. If calling _run directly, ensure path is set before invocation.

Example fix

# before
tool._run(action="list")  # ValueError

# after
tool.run(action="list", path="/workspace")
Defensive patterns

Strategy: validation

Validate before calling

def validated_list_call(tool, path: str | None) -> Any:
    directory = path or "/workspace"  # explicit default; the tool has none
    return tool.run(action="list", path=directory)

Try / catch

try:
    entries = tool.run(action="list", path=p)
except ValueError as e:
    if "requires 'path'" in str(e):
        entries = tool.run(action="list", path="/workspace")
    else:
        raise

Prevention

When it happens

Trigger: Calling tool._run(action='list', path=None) directly; assuming the tool defaults to the sandbox workspace root when path is omitted; test harness bypassing schema validation.

Common situations: Developers expecting a default directory listing; direct private-method calls in tests; argument dicts missing the path key.

Related errors


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