{"record":{"id":"04ffb2587e682634","repo":"FoundationAgents/OpenManus","slug":"the-path-path-is-a-directory-and-only-the-view","errorCode":null,"errorMessage":"The path {path} is a directory and only the `view` command can be used on directories","messagePattern":"The path (.+?) is a directory and only the `view` command can be used on directories","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"app/tool/str_replace_editor.py","lineNumber":184,"sourceCode":"    async def validate_path(\n        self, command: str, path: Path, operator: FileOperator\n    ) -> None:\n        \"\"\"Validate path and command combination based on execution environment.\"\"\"\n        # Check if path is absolute\n        if not path.is_absolute():\n            raise ToolError(f\"The path {path} is not an absolute path\")\n\n        # Only check if path exists for non-create commands\n        if command != \"create\":\n            if not await operator.exists(path):\n                raise ToolError(\n                    f\"The path {path} does not exist. Please provide a valid path.\"\n                )\n\n            # Check if path is a directory\n            is_dir = await operator.is_directory(path)\n            if is_dir and command != \"view\":\n                raise ToolError(\n                    f\"The path {path} is a directory and only the `view` command can be used on directories\"\n                )\n\n        # Check if file exists for create command\n        elif command == \"create\":\n            exists = await operator.exists(path)\n            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.\"\"\"","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/tool/str_replace_editor.py#L166-L202","documentation":"Error \"The path {path} is a directory and only the `view` command can be used on directories\" thrown in FoundationAgents/OpenManus.","triggerScenarios":"Raised when a command other than `view` (e.g. create, str_replace, insert) is attempted on a path that is a directory.","commonSituations":"See trigger scenarios.","solutions":["Use command `view` when `path` points to a directory; editing commands only work on files."],"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-15T22:17:37.221Z"}