crewAIInc/crewAI · error · ValueError

action='chmod' requires 'path'

Error message

action='chmod' requires 'path'

What it means

action='chmod' in DaytonaFileTool._run needs a 'path' to apply permission/ownership changes to via self._chmod(sandbox, path, mode=mode, owner=owner, group=group). A None path raises ValueError before any sandbox command runs. mode, owner, and group are optional; only path is mandatory.

Source

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

                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:
            self._release_sandbox(sandbox, should_delete)

    def _read(self, sandbox: Any, path: str, *, binary: bool) -> dict[str, Any]:
        data: bytes = sandbox.fs.download_file(path)
        if binary:
            return {
                "path": path,
                "encoding": "base64",

View on GitHub (pinned to 754d7323be)

Solutions

  1. Include the target: _run(action='chmod', path='/workspace/run.sh', mode='0755').
  2. Pre-validate that chmod calls carry a path.
  3. Require agents to restate the full path in every chmod step of a plan.

Example fix

# before
file_tool._run(action='chmod', mode='0755')

# after
file_tool._run(action='chmod', path='/workspace/run.sh', mode='0755')
Defensive patterns

Strategy: validation

Validate before calling

def chmod(file_tool, path: str | None, mode: str | None = None):
    if not path:
        raise ValueError("action='chmod' requires 'path'")
    return file_tool._run(action='chmod', path=path, mode=mode)

Try / catch

try:
    file_tool._run(action='chmod', path=path, mode=mode)
except ValueError as e:
    if "chmod" in str(e):
        raise PermissionPlanError('chmod step missing target path') from e
    raise

Prevention

When it happens

Trigger: Calling _run(action='chmod', mode='0644') with no path; agents that list the desired permissions but forget the target file; passing the target as 'file' instead of 'path'.

Common situations: Agents paraphrasing a chmod request and dropping the filename; users assuming the tool applies to the most recently written file (it does not — each call is independent).

Related errors


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