{"record":{"id":"b07cc39abb58d677","repo":"FoundationAgents/OpenManus","slug":"failed-to-copy-file-e","errorCode":null,"errorMessage":"Failed to copy file: {e}","messagePattern":"Failed to copy file: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"app/sandbox/core/sandbox.py","lineNumber":313,"sourceCode":"                    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\n            # Create destination directory in container\n            resolved_dst = self._safe_resolve_path(dst_path)","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/sandbox/core/sandbox.py#L295-L331","documentation":"Catch-all RuntimeError from DockerSandbox.copy_from (app/sandbox/core/sandbox.py:313): any failure in the copy-out pipeline other than docker NotFound — writing the streamed tar to the temp file, tarfile.open/extract, extracting to dst, or host-side I/O (disk full, permission denied on dst_path). The specific cause is preserved in {e}.","triggerScenarios":"Host destination not writable or parent missing when opening dst_path; disk full while writing chunks; corrupted tar stream; tarfile.ExtractError on malformed archives; tempfile.TemporaryDirectory cleanup races.","commonSituations":"Running the host process as a user without write access to the destination; copying large artifacts to a full disk; antivirus/locked files on the host interfering with extraction; paths with spaces mishandled by surrounding code.","solutions":["Read {e} to separate host I/O errors (PermissionError, ENOSPC) from tar errors.","Pre-create and pre-check the destination: os.makedirs(dirname, exist_ok=True) and verify writability.","Free host disk space; check df at the destination.","Retry once on transient stream corruption; if persistent, fall back to run_command('cat path') for single small text files."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"os.makedirs(os.path.dirname(os.path.abspath(dst)) or \".\", exist_ok=True)\nassert os.access(os.path.dirname(os.path.abspath(dst)), os.W_OK)","typeGuard":null,"tryCatchPattern":"try:\n    await sandbox.copy_from(src, dst)\nexcept RuntimeError as e:\n    cause = e.__cause__ or e\n    if isinstance(cause, PermissionError):\n        os.chmod(dst_dir, 0o755); await sandbox.copy_from(src, dst)\n    else:\n        raise","preventionTips":["Pre-create destination directories and check writability","Watch host disk space before large copies","Retry once on transient stream errors","Read __cause__ to distinguish host I/O from tar errors"],"tags":["sandbox","copy","host-io","tar","wrapper-exception"],"backgroundTag":null,"analyzedSha":"52a13f2a57d8c7f6737eefb02ccf569594d44273","analyzedAt":"2026-08-15T02:33:49.993Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}