FoundationAgents/OpenManus · error · ToolError

Parameter `old_str` is required for command: str_replace

Error message

Parameter `old_str` is required for command: str_replace

What it means

Error "Parameter `old_str` is required for command: str_replace" thrown in FoundationAgents/OpenManus.

Source

Thrown at app/tool/str_replace_editor.py:144

        """Execute a file operation command."""
        # Get the appropriate file operator
        operator = self._get_operator()

        # Validate path and command combination
        await self.validate_path(command, Path(path), operator)

        # Execute the appropriate command
        if command == "view":
            result = await self.view(path, view_range, operator)
        elif command == "create":
            if file_text is None:
                raise ToolError("Parameter `file_text` is required for command: create")
            await operator.write_file(path, file_text)
            self._file_history[path].append(file_text)
            result = ToolResult(output=f"File created successfully at: {path}")
        elif command == "str_replace":
            if old_str is None:
                raise ToolError(
                    "Parameter `old_str` is required for command: str_replace"
                )
            result = await self.str_replace(path, old_str, new_str, operator)
        elif command == "insert":
            if insert_line is None:
                raise ToolError(
                    "Parameter `insert_line` is required for command: insert"
                )
            if new_str is None:
                raise ToolError("Parameter `new_str` is required for command: insert")
            result = await self.insert(path, insert_line, new_str, operator)
        elif command == "undo_edit":
            result = await self.undo_edit(path, operator)
        else:
            # This should be caught by type checking, but we include it for safety
            raise ToolError(
                f'Unrecognized command {command}. The allowed commands for the {self.name} tool are: {", ".join(get_args(Command))}'
            )

View on GitHub (pinned to 52a13f2a57)

Solutions

  1. Pass the `old_str` parameter containing the exact text to replace when using command `str_replace`.

When it happens

Trigger: Raised when the `str_replace` command is called without the required `old_str` parameter.

Common situations: See trigger scenarios.


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