crewAIInc/crewAI · error · ValueError

action='append' requires 'path'

Error message

action='append' requires 'path'

What it means

DaytonaFileTool._run's defensive check for action='append': path must not be None before self._append(sandbox, path, content or "") runs. The schema validator already requires both path and content for append, so this branch is effectively dead code unless _run is invoked directly, skipping Pydantic validation.

Source

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

        pattern: str | None = None,
        replacement: str | None = None,
        paths: list[str] | None = None,
        owner: str | None = None,
        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:

View on GitHub (pinned to 754d7323be)

Solutions

  1. Route through the public API: tool.run(action='append', path='/workspace/log.txt', content='line').
  2. When calling _run directly, always supply path (and content).
  3. Validate arguments against DaytonaFileToolSchema first.

Example fix

# before
tool._run(action="append", path=None, content="x")  # ValueError

# after
tool.run(action="append", path="/workspace/log.txt", content="x")
Defensive patterns

Strategy: validation

Validate before calling

def validated_append_call(tool, path: str | None, content: str | None) -> Any:
    if path is None or content is None:
        raise ValueError("append requires both path and content")
    return tool.run(action="append", path=path, content=content)

Try / catch

try:
    res = tool.run(action="append", path=p, content=c)
except ValueError as e:
    if "requires 'path'" in str(e):
        raise ValueError("append target missing; cannot infer safely") from e
    raise

Prevention

When it happens

Trigger: Direct tool._run(action='append', path=None, ...) calls; test code or custom integrations that bypass the schema; kwargs assembled with a missing 'path' key.

Common situations: Unit tests calling the private method; wrapper code invoking _run for speed; partially-built argument dictionaries.

Related errors


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