crewAIInc/crewAI · error · ValueError

action='mkdir' requires 'path'

Error message

action='mkdir' requires 'path'

What it means

DaytonaFileTool._run requires a 'path' argument when action='mkdir' so it knows which folder to create in the sandbox. If path is None the tool raises ValueError immediately instead of calling sandbox.fs.create_folder. An optional 'mode' argument (default '0755') is applied only after the path check passes. This is purely client-side input validation.

Source

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

                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:
                    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:

View on GitHub (pinned to 754d7323be)

Solutions

  1. Pass the folder location as path: _run(action='mkdir', path='/data/scratch', mode='0755').
  2. Refer to the tool's args_schema to confirm 'path' is the correct keyword for every action.
  3. Pre-validate kwargs in a wrapper: if action == 'mkdir' assert path is not None.
  4. Improve the tool description given to the agent so it always emits path.

Example fix

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

# after
file_tool._run(action='mkdir', path='/data/scratch', mode='0755')
Defensive patterns

Strategy: validation

Validate before calling

if action == 'mkdir' and not kwargs.get('path'):
    raise ValueError("action='mkdir' requires 'path'")

Try / catch

try:
    file_tool._run(action='mkdir', **kwargs)
except ValueError as e:
    # argument error: fix kwargs and retry once with corrected input
    handle_missing_argument('mkdir', 'path', e)

Prevention

When it happens

Trigger: Calling _run(action='mkdir') with no path, or supplying the folder name via 'destination' or 'name' instead of 'path'. An agent emitting {"action": "mkdir", "mode": "0700"} without a location.

Common situations: LLM tool calls that include the mode but drop the path; users assuming mkdir takes a 'directory' kwarg because other tools name it that; typos in the kwarg name.

Related errors


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