slimtoolkit/slim · error

Pod not running

Error message

Pod not running

What it means

ErrPodNotRunning is returned by listAllActiveContainers, listK8sDebugContainers and listK8sDebuggableContainers when the Kubernetes pod being debugged exists but is not in a Running phase. Debug operations require at least one running container to attach to.

Source

Thrown at pkg/app/master/command/debug/handle_kubernetes_runtime.go:1000

	}

	err := wait.PollImmediate(2*time.Second, 2*time.Minute, isPodRunning)
	if err != nil {
		return nil, "", err
	}

	return outputPod, podName, nil
}

const (
	ctInit      = "init"
	ctStandard  = "standard"
	ctEphemeral = "ephemeral"
)

var (
	ErrPodTerminated       = errors.New("Pod terminated")
	ErrPodNotRunning       = errors.New("Pod not running")
	ErrContainerTerminated = errors.New("Container terminated")
)

func waitForContainer(
	logger *log.Entry,
	xc *app.ExecutionContext,
	ctx context.Context,
	api *kubernetes.Clientset,
	nsName string,
	podName string,
	containerName string,
	containerType string) error {
	logger.Tracef("waitForContainer(%s,%s,%s,%s)", nsName, podName, containerName, containerType)

	isContainerRunning := func() (bool, error) {
		pod, err := api.CoreV1().Pods(nsName).Get(ctx, podName, metav1.GetOptions{})
		if err != nil {
			return false, err

View on GitHub (pinned to 81940d17fa)

Solutions

  1. Wait until the pod reports Running (kubectl wait --for=condition=Ready pod/<name>) then retry
  2. Check pod events (kubectl describe pod) for scheduling/image-pull problems and fix those first
  3. Target a different, already-running pod for debugging

Example fix

kubectl wait --for=condition=Ready pod/my-pod --timeout=120s
# then re-run the debug command
Defensive patterns

Strategy: retry

Validate before calling

err := wait.PollImmediate(2*time.Second, 2*time.Minute, func() (bool, error) {
	p, _ := clientset.CoreV1().Pods(ns).Get(ctx, name, metav1.GetOptions{})
	return p.Status.Phase == corev1.PodRunning, nil
})

Try / catch

// Go
if errors.Is(err, ErrPodNotRunning) {
	// wait for readiness then retry the debug operation
}

Prevention

When it happens

Trigger: Invoking the k8s debug container listing against a pod that is Pending, ContainerCreating, or otherwise not Running; pod restarted into a non-running state mid-operation.

Common situations: Insufficient cluster resources keep the pod Pending; image pull delays; crash loops that leave the pod Restarting; debugging a freshly created pod before it starts.

Related errors


AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31). Data as JSON: /api/errors/bee350a5a593f23d. Report an issue: GitHub.