{"record":{"id":"2eeb538ffa07f04d","repo":"agentscope-ai/agentscope","slug":"pod-self-pod-name-r-is-unschedulable-cond-mes","errorCode":null,"errorMessage":"Pod {self._pod_name!r} is unschedulable: {cond.message}","messagePattern":"Pod (.+?) is unschedulable: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"src/agentscope/workspace/_k8s/_k8s_workspace.py","lineNumber":553,"sourceCode":"                )\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 \"\n            f\"within {timeout}s\",\n        )\n\n    async def _wait_pod_deleted(self, timeout: float = 30.0) -> None:\n        \"\"\"Poll until the Pod is gone.\"\"\"\n        from kubernetes_asyncio.client.rest import ApiException\n\n        deadline = asyncio.get_event_loop().time() + timeout\n        while asyncio.get_event_loop().time() < deadline:\n            try:","sourceCodeStart":535,"sourceCodeEnd":571,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/workspace/_k8s/_k8s_workspace.py#L535-L571","documentation":"Raised when the workspace Pod is Pending with a PodScheduled/PodReady condition set to False with reason Unschedulable — the cluster cannot place the Pod. The condition's message (typically '0/N nodes are available: ...') explains which constraint failed.","triggerScenarios":"Insufficient cluster resources (CPU/memory requests exceed capacity); nodeSelector/affinity or taints/tolerations that exclude all nodes; PVC unavailable in a zone with no nodes; volume capacity limits hit.","commonSituations":"Agent workspaces requesting large resources on small clusters; taints (e.g. dedicated=agent:NoSchedule) without matching tolerations; cluster-autoscaler disabled or at capacity.","solutions":["Read cond.message — it names the exact scheduling constraint that failed","Lower the workspace Pod's resource requests or add nodes / enable the autoscaler","Fix nodeSelector/affinity/tolerations in the workspace Pod spec so at least one node matches","Ensure the PVC's StorageClass can provision in a zone where nodes exist"],"exampleFix":"# before\nws = K8sWorkspace(resources={\"cpu\": \"8\", \"memory\": \"32Gi\"})  # unschedulable\n\n# after\nws = K8sWorkspace(resources={\"cpu\": \"1\", \"memory\": \"2Gi\"})  # fits node capacity","handlingStrategy":"validation","validationCode":"from kubernetes.client import CoreV1Api\nnodes = CoreV1Api().list_node().items\nalloc_ok = any(\n    n.status.allocatable.get(\"cpu\") not in (None, \"0\") for n in nodes\n)\n# also verify nodeSelector/tolerations match at least one node before start","typeGuard":"null","tryCatchPattern":"try:\n    await ws.start()\nexcept RuntimeError as e:\n    if \"unschedulable\" in str(e):\n        # parse cond.message, lower requests or add nodes, retry\n        raise","preventionTips":["Keep workspace resource requests small","Ensure tolerations match cluster taints","Verify StorageClass zones align with node zones"],"tags":["kubernetes","unschedulable","scheduling","resource-quotas"],"backgroundTag":"kubernetes-unschedulable-pod","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}