{"record":{"id":"2bb2cc48a24607f6","repo":"agentscope-ai/agentscope","slug":"write-to-path-r-failed-command-0-exited-exi","errorCode":null,"errorMessage":"write to {path!r} failed: {command[0]} exited {exit_code}: {stderr_text}","messagePattern":"write to (.+?) failed: (.+?) exited (.+?): (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/agentscope/workspace/_k8s/_k8s_backend.py","lineNumber":407,"sourceCode":"                        import json\n\n                        try:\n                            status = json.loads(\n                                payload.decode(\"utf-8\"),\n                            )\n                            if status.get(\"status\") != \"Success\":\n                                exit_code = 1\n                        except (\n                            json.JSONDecodeError,\n                            ValueError,\n                        ):\n                            exit_code = 1\n\n            if exit_code != 0:\n                stderr_text = b\"\".join(stderr_parts).decode(\n                    errors=\"replace\",\n                )\n                raise RuntimeError(\n                    f\"write to {path!r} failed: \"\n                    f\"{command[0]} exited {exit_code}: {stderr_text}\",\n                )\n","sourceCodeStart":389,"sourceCodeEnd":411,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/workspace/_k8s/_k8s_backend.py#L389-L411","documentation":"Raised when a write into the Kubernetes workspace Pod fails: the command used to receive the tar stream (e.g. tar or dd) exited with a non-zero status and its stderr is included in the message. The library pipes an in-memory tar archive over WebSocket stdin to a command inside the Pod, so failures come from the container side (disk full, read-only filesystem, missing tar binary, permission denied).","triggerScenarios":"write_file or write_stream to a path on a full PVC (exit code from tar: 'No space left on device'); target filesystem mounted read-only; the 'tar' binary missing in a minimal/distroless image; permission errors writing to a path owned by another UID.","commonSituations":"Small PVC requests that fill up with agent artifacts; distroless or scratch images without tar; securityContext running as non-root while the volume is root-owned; writing outside the mounted volume into an immutable layer.","solutions":["Run 'kubectl exec <pod> -- df -h' and enlarge the PVC or prune files if disk is full","Verify tar exists in the image (kubectl exec <pod> -- which tar); switch to an image that includes it","Write only inside the mounted workspace volume and check directory permissions/ownership","Align securityContext runAsUser/fsGroup with the volume's file ownership"],"exampleFix":"# before\nawait ws.write_file(\"/workspace/big.bin\", data)  # RuntimeError: tar exited 1: No space left on device\n\n# after\n# enlarge PVC (or clean up) then retry with a guard\ntry:\n    await ws.write_file(\"/workspace/big.bin\", data)\nexcept RuntimeError as e:\n    logging.warning(\"pod write failed: %s\", e)\n    await cleanup_workspace(ws)","handlingStrategy":"try-catch","validationCode":"null","typeGuard":null,"tryCatchPattern":"try:\n    await ws.write_file(path, data)\nexcept RuntimeError as e:\n    log.error(\"pod write failed: %s\", e)\n    # inspect stderr in message: disk-full / read-only / permission\n    raise","preventionTips":["Monitor PVC usage and prune old artifacts","Confirm tar exists in the workspace image","Write only inside the mounted, writable workspace volume","Match securityContext UIDs with volume ownership"],"tags":["kubernetes","disk-full","write-failure","tar","workspace"],"backgroundTag":"remote-command-exit-nonzero","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}