{"record":{"id":"19e70a990e1a0e9a","repo":"FoundationAgents/OpenManus","slug":"source-file-not-found-src-path","errorCode":null,"errorMessage":"Source file not found: {src_path}","messagePattern":"Source file not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"app/sandbox/core/sandbox.py","lineNumber":311,"sourceCode":"                    if os.path.isdir(dst_path):\n                        tar.extractall(dst_path)\n                    else:\n                        # If destination is a file, we only extract the source file's content\n                        if len(members) > 1:\n                            raise RuntimeError(\n                                f\"Source path is a directory but destination is a file: {src_path}\"\n                            )\n\n                        with open(dst_path, \"wb\") as dst:\n                            src_file = tar.extractfile(members[0])\n                            if src_file is None:\n                                raise RuntimeError(\n                                    f\"Failed to extract file: {src_path}\"\n                                )\n                            dst.write(src_file.read())\n\n        except docker.errors.NotFound:\n            raise FileNotFoundError(f\"Source file not found: {src_path}\")\n        except Exception as e:\n            raise RuntimeError(f\"Failed to copy file: {e}\")\n\n    async def copy_to(self, src_path: str, dst_path: str) -> None:\n        \"\"\"Copies a file to the container.\n\n        Args:\n            src_path: Source file path (host).\n            dst_path: Destination path (container).\n\n        Raises:\n            FileNotFoundError: If source file does not exist.\n            RuntimeError: If copy operation fails.\n        \"\"\"\n        try:\n            if not os.path.exists(src_path):\n                raise FileNotFoundError(f\"Source file not found: {src_path}\")\n","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/sandbox/core/sandbox.py#L293-L329","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nawait sandbox.copy_from(\"/workspace/build/out.bin\", \"./out.bin\")\n\n# after\nif \"ok\" in await sandbox.run_command(\"test -e /workspace/build/out.bin && echo ok\"):\n    await sandbox.copy_from(\"/workspace/build/out.bin\", \"./out.bin\")","handlingStrategy":"validation","validationCode":"exists = (await sandbox.run_command(f\"test -e {shlex.quote(src)} && echo 1\")).strip() == \"1\"","typeGuard":null,"tryCatchPattern":"try:\n    await sandbox.copy_from(src, dst)\nexcept FileNotFoundError:\n    log.warning(\"artifact %s missing in container — producer failed?\", src)","preventionTips":["Verify artifacts exist before copying","Use absolute container paths identical to those the producer wrote","Gate on producer exit code"],"tags":["sandbox","copy","not-found","docker-api"],"backgroundTag":null,"analyzedSha":"52a13f2a57d8c7f6737eefb02ccf569594d44273","analyzedAt":"2026-08-15T02:33:49.993Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}