{"record":{"id":"489c9ba564eb9d19","repo":"agentscope-ai/agentscope","slug":"not-found-in-pod-path-tar-stderr-stderr-text","errorCode":null,"errorMessage":"not found in Pod: {path} (tar stderr: {stderr_text})","messagePattern":"not found in Pod: (.+?) \\(tar stderr: (.+?)\\)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"src/agentscope/workspace/_k8s/_k8s_backend.py","lineNumber":239,"sourceCode":"        Raises:\n            `FileNotFoundError`:\n                If the path does not exist inside the Pod.\n        \"\"\"\n        dirname = posixpath.dirname(path) or \"/\"\n        basename = posixpath.basename(path)\n\n        result = await self.exec_shell(\n            [\"tar\", \"cf\", \"-\", \"-C\", dirname, basename],\n            cwd=\"/\",\n        )\n        if not result.ok():\n            stderr_text = result.stderr.decode(errors=\"replace\")\n            if \"No such file\" in stderr_text or \"not found\" in stderr_text:\n                raise FileNotFoundError(\n                    f\"not found in Pod: {path}\",\n                )\n            raise FileNotFoundError(\n                f\"not found in Pod: {path} (tar stderr: {stderr_text})\",\n            )\n\n        try:\n            tar = tarfile.open(fileobj=io.BytesIO(result.stdout), mode=\"r\")\n        except tarfile.ReadError as exc:\n            raise FileNotFoundError(\n                f\"not found in Pod: {path}\",\n            ) from exc\n\n        try:\n            for member in tar.getmembers():\n                if member.isfile():\n                    f = tar.extractfile(member)\n                    if f:\n                        return f.read()\n        finally:\n            tar.close()\n","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/workspace/_k8s/_k8s_backend.py#L221-L257","documentation":"Raised by K8sBackend.read_file() when the in-Pod `tar cf -` fails with an error that does NOT match the known 'No such file'/'not found' patterns. The raw tar stderr is appended. The library still maps it to FileNotFoundError, but the real cause is visible only in the parenthesized stderr — e.g. permission denied, tar not installed, or path syntax errors.","triggerScenarios":"`await backend.read_file(path)` where tar fails for a non-existence reason: 'Permission denied' on the directory, 'tar: command not found' in a minimal image, 'Cannot open: No such file or directory' variants worded differently by the tar implementation (e.g. BusyBox vs GNU tar).","commonSituations":"Minimal/distroless Pod images without tar; reading files under directories with restrictive permissions (different UID); BusyBox tar wording that doesn't match the pattern; reading a path that is a broken symlink.","solutions":["Read the tar stderr in the message — it carries the true failure reason","If tar is missing, use an image that includes tar (or add it) since this backend depends on tar streaming","For permission errors, adjust the exec user or the file's permissions in the Pod","Check the path is an absolute in-Pod path, not a host or container-escape path"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"res = await backend.exec_shell([\"tar\", \"--version\"])\nif not res.ok():\n    raise RuntimeError(\"tar missing in Pod image; read_file requires tar\")","typeGuard":null,"tryCatchPattern":"try:\n    data = await backend.read_file(path)\nexcept FileNotFoundError as e:\n    if \"tar stderr\" in str(e):\n        # real cause is in stderr (permissions / missing tar), not a plain miss\n        logger.error(\"read_file underlying failure: %s\", e)\n    raise","preventionTips":["Ensure the Pod image ships tar","Check directory permissions for the exec user","Read the parenthesized stderr before assuming the file is missing"],"tags":["kubernetes","pod","tar","file-not-found","permissions"],"backgroundTag":"file-not-found-in-container","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}