{"record":{"id":"ee7f767dec393072","repo":"FoundationAgents/OpenManus","slug":"the-view-range-parameter-is-not-allowed-when-pa","errorCode":null,"errorMessage":"The `view_range` parameter is not allowed when `path` points to a directory.","messagePattern":"The `view_range` parameter is not allowed when `path` points to a directory\\.","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"app/tool/str_replace_editor.py","lineNumber":209,"sourceCode":"            if exists:\n                raise ToolError(\n                    f\"File already exists at: {path}. Cannot overwrite files using command `create`.\"\n                )\n\n    async def view(\n        self,\n        path: PathLike,\n        view_range: Optional[List[int]] = None,\n        operator: FileOperator = None,\n    ) -> CLIResult:\n        \"\"\"Display file or directory content.\"\"\"\n        # Determine if path is a directory\n        is_dir = await operator.is_directory(path)\n\n        if is_dir:\n            # Directory handling\n            if view_range:\n                raise ToolError(\n                    \"The `view_range` parameter is not allowed when `path` points to a directory.\"\n                )\n\n            return await self._view_directory(path, operator)\n        else:\n            # File handling\n            return await self._view_file(path, operator, view_range)\n\n    @staticmethod\n    async def _view_directory(path: PathLike, operator: FileOperator) -> CLIResult:\n        \"\"\"Display directory contents.\"\"\"\n        find_cmd = f\"find {path} -maxdepth 2 -not -path '*/\\\\.*'\"\n\n        # Execute command using the operator\n        returncode, stdout, stderr = await operator.run_command(find_cmd)\n\n        if not stderr:\n            stdout = (","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/tool/str_replace_editor.py#L191-L227","documentation":"Error \"The `view_range` parameter is not allowed when `path` points to a directory.\" thrown in FoundationAgents/OpenManus.","triggerScenarios":"Raised when `view_range` is supplied while the `path` points to a directory; ranges apply only to files.","commonSituations":"See trigger scenarios.","solutions":["Remove the `view_range` parameter when viewing a directory; directory listings always show contents up to 2 levels deep."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"52a13f2a57d8c7f6737eefb02ccf569594d44273","analyzedAt":"2026-08-15T02:33:49.993Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}