agentscope-ai/agentscope · critical · RuntimeError

Pod {self._pod_name!r} is unschedulable: {cond.message}

Error message

Pod {self._pod_name!r} is unschedulable: {cond.message}

What it means

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.

Source

Thrown at src/agentscope/workspace/_k8s/_k8s_workspace.py:553

                )

            if phase == "Pending" and pod.status:
                for cs in pod.status.container_statuses or []:
                    if cs.state and cs.state.waiting:
                        reason = cs.state.waiting.reason or ""
                        if reason in _TERMINAL_WAITING_REASONS:
                            msg = cs.state.waiting.message or reason
                            raise RuntimeError(
                                f"Pod {self._pod_name!r} container "
                                f"is stuck: {msg}",
                            )
                for cond in pod.status.conditions or []:
                    if (
                        cond.type in _UNSCHEDULABLE_TYPES
                        and cond.status == "False"
                        and cond.reason == "Unschedulable"
                    ):
                        raise RuntimeError(
                            f"Pod {self._pod_name!r} is "
                            f"unschedulable: {cond.message}",
                        )

            await asyncio.sleep(delay)
            delay = min(delay * 1.5, 3.0)
        raise RuntimeError(
            f"Pod {self._pod_name!r} did not become Running "
            f"within {timeout}s",
        )

    async def _wait_pod_deleted(self, timeout: float = 30.0) -> None:
        """Poll until the Pod is gone."""
        from kubernetes_asyncio.client.rest import ApiException

        deadline = asyncio.get_event_loop().time() + timeout
        while asyncio.get_event_loop().time() < deadline:
            try:

View on GitHub (pinned to e90f1c7592)

Solutions

  1. Read cond.message — it names the exact scheduling constraint that failed
  2. Lower the workspace Pod's resource requests or add nodes / enable the autoscaler
  3. Fix nodeSelector/affinity/tolerations in the workspace Pod spec so at least one node matches
  4. Ensure the PVC's StorageClass can provision in a zone where nodes exist

Example fix

# before
ws = K8sWorkspace(resources={"cpu": "8", "memory": "32Gi"})  # unschedulable

# after
ws = K8sWorkspace(resources={"cpu": "1", "memory": "2Gi"})  # fits node capacity
Defensive patterns

Strategy: validation

Validate before calling

from kubernetes.client import CoreV1Api
nodes = CoreV1Api().list_node().items
alloc_ok = any(
    n.status.allocatable.get("cpu") not in (None, "0") for n in nodes
)
# also verify nodeSelector/tolerations match at least one node before start

Type guard

null

Try / catch

try:
    await ws.start()
except RuntimeError as e:
    if "unschedulable" in str(e):
        # parse cond.message, lower requests or add nodes, retry
        raise

Prevention

When it happens

Trigger: 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.

Common situations: Agent workspaces requesting large resources on small clusters; taints (e.g. dedicated=agent:NoSchedule) without matching tolerations; cluster-autoscaler disabled or at capacity.

Related errors


AI-assisted analysis of agentscope-ai/agentscope@e90f1c7592 (2026-08-28). Data as JSON: /api/errors/2eeb538ffa07f04d. Report an issue: GitHub.