FoundationAgents/OpenManus · error · FileNotFoundError
Source file not found: {src_path}
Error message
Source file not found: {src_path} What it means
Raised as FileNotFoundError by DockerSandbox.copy_from (app/sandbox/core/sandbox.py:311) when the underlying Docker archive fetch raises docker.errors.NotFound — the source path does not exist inside the container. This is the pre-extraction existence check: it fires before any tar processing (unlike errors 33–35 which occur after a successful fetch).
Source
Thrown at app/sandbox/core/sandbox.py:311
if os.path.isdir(dst_path):
tar.extractall(dst_path)
else:
# If destination is a file, we only extract the source file's content
if len(members) > 1:
raise RuntimeError(
f"Source path is a directory but destination is a file: {src_path}"
)
with open(dst_path, "wb") as dst:
src_file = tar.extractfile(members[0])
if src_file is None:
raise RuntimeError(
f"Failed to extract file: {src_path}"
)
dst.write(src_file.read())
except docker.errors.NotFound:
raise FileNotFoundError(f"Source file not found: {src_path}")
except Exception as e:
raise RuntimeError(f"Failed to copy file: {e}")
async def copy_to(self, src_path: str, dst_path: str) -> None:
"""Copies a file to the container.
Args:
src_path: Source file path (host).
dst_path: Destination path (container).
Raises:
FileNotFoundError: If source file does not exist.
RuntimeError: If copy operation fails.
"""
try:
if not os.path.exists(src_path):
raise FileNotFoundError(f"Source file not found: {src_path}")
View on GitHub (pinned to 52a13f2a57)
Solutions
- Verify before copying: run_command(f"test -e {src_path} && echo ok").
- Use the same absolute container path that the producing command wrote to.
- Check the producer's exit code/output before fetching artifacts.
Example fix
# before
await sandbox.copy_from("/workspace/build/out.bin", "./out.bin")
# after
if "ok" in await sandbox.run_command("test -e /workspace/build/out.bin && echo ok"):
await sandbox.copy_from("/workspace/build/out.bin", "./out.bin") Defensive patterns
Strategy: validation
Validate before calling
exists = (await sandbox.run_command(f"test -e {shlex.quote(src)} && echo 1")).strip() == "1" Try / catch
try:
await sandbox.copy_from(src, dst)
except FileNotFoundError:
log.warning("artifact %s missing in container — producer failed?", src) Prevention
- Verify artifacts exist before copying
- Use absolute container paths identical to those the producer wrote
- Gate on producer exit code
When it happens
Trigger: copy_from of an output file/directory that was never produced; typo in the container path; relative path resolved under work_dir where the file is not; file deleted by a cleanup step inside the container.
Common situations: Copying build artifacts after a build command failed; wrong work_dir assumption when the command ran in a different CWD; container restarted/reset between write and copy.
Related errors
- File not found: {path}
- Source file is empty: {src_path}
- Source path is a directory but destination is a file: {src_p
- Failed to extract file: {src_path}
- Failed to copy file: {e}
AI-assisted analysis of FoundationAgents/OpenManus@52a13f2a57 (2026-08-15).
Data as JSON: /api/errors/19e70a990e1a0e9a.
Report an issue: GitHub.