FoundationAgents/OpenManus · error · ToolError
Invalid `view_range`. It should be a list of two integers.
Error message
Invalid `view_range`. It should be a list of two integers.
What it means
Error "Invalid `view_range`. It should be a list of two integers." thrown in FoundationAgents/OpenManus.
Source
Thrown at app/tool/str_replace_editor.py:248
)
return CLIResult(output=stdout, error=stderr)
async def _view_file(
self,
path: PathLike,
operator: FileOperator,
view_range: Optional[List[int]] = None,
) -> CLIResult:
"""Display file content, optionally within a specified line range."""
# Read file content
file_content = await operator.read_file(path)
init_line = 1
# Apply view range if specified
if view_range:
if len(view_range) != 2 or not all(isinstance(i, int) for i in view_range):
raise ToolError(
"Invalid `view_range`. It should be a list of two integers."
)
file_lines = file_content.split("\n")
n_lines_file = len(file_lines)
init_line, final_line = view_range
# Validate view range
if init_line < 1 or init_line > n_lines_file:
raise ToolError(
f"Invalid `view_range`: {view_range}. Its first element `{init_line}` should be "
f"within the range of lines of the file: {[1, n_lines_file]}"
)
if final_line > n_lines_file:
raise ToolError(
f"Invalid `view_range`: {view_range}. Its second element `{final_line}` should be "
f"smaller than the number of lines in the file: `{n_lines_file}`"
)View on GitHub (pinned to 52a13f2a57)
Solutions
- Pass `view_range` as a list of two integers, e.g. [1, 50]; use -1 as the second element for end of file.
When it happens
Trigger: Raised when `view_range` is not a list of exactly two integers.
Common situations: See trigger scenarios.
AI-assisted analysis of FoundationAgents/OpenManus@52a13f2a57 (2026-08-15).
Data as JSON: /api/errors/989e3f78507fe95f.
Report an issue: GitHub.