FoundationAgents/OpenManus · error · ToolError

The `view_range` parameter is not allowed when `path` points

Error message

The `view_range` parameter is not allowed when `path` points to a directory.

What it means

Error "The `view_range` parameter is not allowed when `path` points to a directory." thrown in FoundationAgents/OpenManus.

Source

Thrown at app/tool/str_replace_editor.py:209

            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."""
        # Determine if path is a directory
        is_dir = await operator.is_directory(path)

        if is_dir:
            # Directory handling
            if view_range:
                raise ToolError(
                    "The `view_range` parameter is not allowed when `path` points to a directory."
                )

            return await self._view_directory(path, operator)
        else:
            # File handling
            return await self._view_file(path, operator, view_range)

    @staticmethod
    async def _view_directory(path: PathLike, operator: FileOperator) -> CLIResult:
        """Display directory contents."""
        find_cmd = f"find {path} -maxdepth 2 -not -path '*/\\.*'"

        # Execute command using the operator
        returncode, stdout, stderr = await operator.run_command(find_cmd)

        if not stderr:
            stdout = (

View on GitHub (pinned to 52a13f2a57)

Solutions

  1. Remove the `view_range` parameter when viewing a directory; directory listings always show contents up to 2 levels deep.

When it happens

Trigger: Raised when `view_range` is supplied while the `path` points to a directory; ranges apply only to files.

Common situations: See trigger scenarios.


AI-assisted analysis of FoundationAgents/OpenManus@52a13f2a57 (2026-08-15). Data as JSON: /api/errors/ee7f767dec393072. Report an issue: GitHub.