slimtoolkit/slim · error

Pod terminated

Error message

Pod terminated

What it means

ErrPodTerminated is returned by the Kubernetes debug runtime helpers in pkg/app/master/command/debug/handle_kubernetes_runtime.go when the target pod has terminated before or during the debug operation. Once a pod is terminated its containers cannot be inspected or debugged, so the handler aborts instead of waiting indefinitely.

Source

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

		return false, nil
	}

	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 {

View on GitHub (pinned to 81940d17fa)

Solutions

  1. Confirm the target pod is running: kubectl get pod <name> and check its phase
  2. Re-run the debug command on an active pod or restart/patch the pod to keep it alive
  3. For completed Jobs/CronJobs, debug a fresh running instance instead
Defensive patterns

Strategy: validation

Validate before calling

pod, _ := clientset.CoreV1().Pods(ns).Get(ctx, name, metav1.GetOptions{})
if pod.Status.Phase != corev1.PodRunning {
	return fmt.Errorf("pod %s is %s, cannot debug", name, pod.Status.Phase)
}

Try / catch

// Go
if errors.Is(err, ErrPodTerminated) {
	// surface to user: pick a running pod and retry
}

Prevention

When it happens

Trigger: Running the debug (k8s runtime) command against a pod whose phase is Terminated/Succeeded/Failed; the pod exits while waitForContainer/listing active containers is in progress.

Common situations: Debugging a CrashLoopBackOff or completed Job pod; the workload finished right before the debug command attached; selecting the wrong pod name.

Related errors


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