FoundationAgents/OpenManus · error · ToolError
File already exists at: {path}. Cannot overwrite files using
Error message
File already exists at: {path}. Cannot overwrite files using command `create`. What it means
Error "File already exists at: {path}. Cannot overwrite files using command `create`." thrown in FoundationAgents/OpenManus.
Source
Thrown at app/tool/str_replace_editor.py:192
# Only check if path exists for non-create commands
if command != "create":
if not await operator.exists(path):
raise ToolError(
f"The path {path} does not exist. Please provide a valid path."
)
# Check if path is a directory
is_dir = await operator.is_directory(path)
if is_dir and command != "view":
raise ToolError(
f"The path {path} is a directory and only the `view` command can be used on directories"
)
# Check if file exists for create command
elif command == "create":
exists = await operator.exists(path)
if exists:
raise ToolError(
f"File already exists at: {path}. Cannot overwrite files using command `create`."
)
async def view(
self,
path: PathLike,
view_range: Optional[List[int]] = None,
operator: FileOperator = None,
) -> CLIResult:
"""Display file or directory content."""
# Determine if path is a directory
is_dir = await operator.is_directory(path)
if is_dir:
# Directory handling
if view_range:
raise ToolError(
"The `view_range` parameter is not allowed when `path` points to a directory."View on GitHub (pinned to 52a13f2a57)
Solutions
- Use command `str_replace` or `insert` to modify the existing file instead of `create`.
- Delete or rename the existing file first if you must recreate it.
When it happens
Trigger: Raised when the `create` command targets a path where a file already exists, since create will not overwrite existing files.
Common situations: See trigger scenarios.
AI-assisted analysis of FoundationAgents/OpenManus@52a13f2a57 (2026-08-15).
Data as JSON: /api/errors/886922bbea52cbf2.
Report an issue: GitHub.