{"record":{"id":"f4cd9dc3d55755af","repo":"FoundationAgents/OpenManus","slug":"invalid-view-range-view-range-its-first-elem","errorCode":null,"errorMessage":"Invalid `view_range`: {view_range}. Its first element `{init_line}` should be within the range of lines of the file: {[1, n_lines_file]}","messagePattern":"Invalid `view_range`: (.+?)\\. Its first element `(.+?)` should be within the range of lines of the file: (.+?)","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"app/tool/str_replace_editor.py","lineNumber":258,"sourceCode":"        \"\"\"Display file content, optionally within a specified line range.\"\"\"\n        # Read file content\n        file_content = await operator.read_file(path)\n        init_line = 1\n\n        # Apply view range if specified\n        if view_range:\n            if len(view_range) != 2 or not all(isinstance(i, int) for i in view_range):\n                raise ToolError(\n                    \"Invalid `view_range`. It should be a list of two integers.\"\n                )\n\n            file_lines = file_content.split(\"\\n\")\n            n_lines_file = len(file_lines)\n            init_line, final_line = view_range\n\n            # Validate view range\n            if init_line < 1 or init_line > n_lines_file:\n                raise ToolError(\n                    f\"Invalid `view_range`: {view_range}. Its first element `{init_line}` should be \"\n                    f\"within the range of lines of the file: {[1, n_lines_file]}\"\n                )\n            if final_line > n_lines_file:\n                raise ToolError(\n                    f\"Invalid `view_range`: {view_range}. Its second element `{final_line}` should be \"\n                    f\"smaller than the number of lines in the file: `{n_lines_file}`\"\n                )\n            if final_line != -1 and final_line < init_line:\n                raise ToolError(\n                    f\"Invalid `view_range`: {view_range}. Its second element `{final_line}` should be \"\n                    f\"larger or equal than its first `{init_line}`\"\n                )\n\n            # Apply range\n            if final_line == -1:\n                file_content = \"\\n\".join(file_lines[init_line - 1 :])\n            else:","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/tool/str_replace_editor.py#L240-L276","documentation":"Error \"Invalid `view_range`: {view_range}. Its first element `{init_line}` should be within the range of lines of the file: {[1, n_lines_file]}\" thrown in FoundationAgents/OpenManus.","triggerScenarios":"Raised when the first element of `view_range` is outside the file's line range of 1 to the number of lines in the file.","commonSituations":"See trigger scenarios.","solutions":["Set the first element of `view_range` to a value within [1, number_of_lines] as reported in the error message.","View the file without `view_range` first to learn its length."],"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"}