{"record":{"id":"c0ff1d4e38ac0673","repo":"agentscope-ai/agentscope","slug":"pod-self-pod-name-r-container-is-stuck-msg","errorCode":null,"errorMessage":"Pod {self._pod_name!r} container is stuck: {msg}","messagePattern":"Pod (.+?) container is stuck: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"src/agentscope/workspace/_k8s/_k8s_workspace.py","lineNumber":543,"sourceCode":"            pod = await self._v1.read_namespaced_pod(\n                self._pod_name,\n                self._namespace,\n            )\n            phase = pod.status.phase if pod.status else None\n            if phase == \"Running\":\n                return\n            if phase in (\"Failed\", \"Unknown\"):\n                raise RuntimeError(\n                    f\"Pod {self._pod_name!r} entered {phase} state\",\n                )\n\n            if phase == \"Pending\" and pod.status:\n                for cs in pod.status.container_statuses or []:\n                    if cs.state and cs.state.waiting:\n                        reason = cs.state.waiting.reason or \"\"\n                        if reason in _TERMINAL_WAITING_REASONS:\n                            msg = cs.state.waiting.message or reason\n                            raise RuntimeError(\n                                f\"Pod {self._pod_name!r} container \"\n                                f\"is stuck: {msg}\",\n                            )\n                for cond in pod.status.conditions or []:\n                    if (\n                        cond.type in _UNSCHEDULABLE_TYPES\n                        and cond.status == \"False\"\n                        and cond.reason == \"Unschedulable\"\n                    ):\n                        raise RuntimeError(\n                            f\"Pod {self._pod_name!r} is \"\n                            f\"unschedulable: {cond.message}\",\n                        )\n\n            await asyncio.sleep(delay)\n            delay = min(delay * 1.5, 3.0)\n        raise RuntimeError(\n            f\"Pod {self._pod_name!r} did not become Running \"","sourceCodeStart":525,"sourceCodeEnd":561,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/workspace/_k8s/_k8s_workspace.py#L525-L561","documentation":"Raised when the workspace Pod is Pending and a container's waiting reason matches a terminal set (e.g. CrashLoopBackOff, ImagePullBackOff, ErrImagePull, CreateContainerConfigError). Instead of waiting out the timeout, the library fails fast with the container's waiting message.","triggerScenarios":"Workspace image that cannot be pulled (bad tag, registry auth missing → ImagePullBackOff); container crashing on startup (CrashLoopBackOff from a failing entrypoint); missing ConfigMap/Secret referenced by the container (CreateContainerConfigError).","commonSituations":"Private registry without configured imagePullSecrets; typo'd image tag; entrypoint script referencing a missing env var; distroless image whose command fails immediately.","solutions":["kubectl get pod <pod> -o jsonpath='{.status.containerStatuses[0].state.waiting}' to see reason/message","Fix the image reference or add imagePullSecrets to the workspace Pod spec","If CrashLoopBackOff, run the image locally or check container logs (kubectl logs --previous)","Supply any required env/ConfigMap/Secret the entrypoint expects"],"exampleFix":"# before\nws = K8sWorkspace(image=\"myrepo/agent-ws:lates\")  # typo -> ImagePullBackOff -> 'is stuck'\n\n# after\nws = K8sWorkspace(image=\"myrepo/agent-ws:latest\", image_pull_secret=\"regcred\")","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try:\n    await ws.start()\nexcept RuntimeError as e:\n    if \"is stuck:\" in str(e):\n        reason = str(e).rsplit(\":\", 1)[-1].strip()\n        # ImagePullBackOff / CrashLoopBackOff handling ...\n        raise","preventionTips":["Use pinned, verified image tags","Configure imagePullSecrets for private registries","Smoke-test the image entrypoint outside Kubernetes"],"tags":["kubernetes","imagepullbackoff","crashloopbackoff","pod-stuck"],"backgroundTag":"kubernetes-container-stuck","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}