FoundationAgents/OpenManus · error · ToolError
The path {path} is a directory and only the `view` command c
Error message
The path {path} is a directory and only the `view` command can be used on directories What it means
Error "The path {path} is a directory and only the `view` command can be used on directories" thrown in FoundationAgents/OpenManus.
Source
Thrown at app/tool/str_replace_editor.py:184
async def validate_path(
self, command: str, path: Path, operator: FileOperator
) -> None:
"""Validate path and command combination based on execution environment."""
# Check if path is absolute
if not path.is_absolute():
raise ToolError(f"The path {path} is not an absolute path")
# Only check if path exists for non-create commands
if command != "create":
if not await operator.exists(path):
raise ToolError(
f"The path {path} does not exist. Please provide a valid path."
)
# Check if path is a directory
is_dir = await operator.is_directory(path)
if is_dir and command != "view":
raise ToolError(
f"The path {path} is a directory and only the `view` command can be used on directories"
)
# Check if file exists for create command
elif command == "create":
exists = await operator.exists(path)
if exists:
raise ToolError(
f"File already exists at: {path}. Cannot overwrite files using command `create`."
)
async def view(
self,
path: PathLike,
view_range: Optional[List[int]] = None,
operator: FileOperator = None,
) -> CLIResult:
"""Display file or directory content."""View on GitHub (pinned to 52a13f2a57)
Solutions
- Use command `view` when `path` points to a directory; editing commands only work on files.
When it happens
Trigger: Raised when a command other than `view` (e.g. create, str_replace, insert) is attempted on a path that is a directory.
Common situations: See trigger scenarios.
AI-assisted analysis of FoundationAgents/OpenManus@52a13f2a57 (2026-08-15).
Data as JSON: /api/errors/04ffb2587e682634.
Report an issue: GitHub.