slimtoolkit/slim · error
pod is done
Error message
pod is done
What it means
ensurePod waits (PollImmediate, up to 2 minutes) for the selected pod to reach the Running phase before attaching the debug container. If the pod reaches Failed or Succeeded instead, the wait aborts with 'pod is done'. The pod has terminated in a terminal state, so debugging its runtime is impossible.
Source
Thrown at pkg/app/master/command/debug/handle_kubernetes_runtime.go:979
return nil, "", fmt.Errorf("no pods")
}
podName = pods.Items[0].Name
}
var outputPod *corev1.Pod
isPodRunning := func() (bool, error) {
pod, err := api.CoreV1().Pods(nsName).Get(ctx, podName, metav1.GetOptions{})
if err != nil {
return false, err
}
switch pod.Status.Phase {
case corev1.PodRunning:
outputPod = pod
return true, nil
case corev1.PodFailed, corev1.PodSucceeded:
return false, fmt.Errorf("pod is done")
}
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"
)
View on GitHub (pinned to 81940d17fa)
Solutions
- Check `kubectl describe pod <pod>` for the terminal reason (exit code, scheduling failure) and fix the workload first.
- Target a long-running pod (e.g., the deployment's ReplicaSet pod) rather than a completed Job pod.
- For crash-looping pods, fix the container crash before attempting a debug session.
- If the pod completed as part of a job, re-run the job and attach the debug session immediately, or use ephemeral debugging on a freshly started pod.
Example fix
// before: targeting a finished job pod slim debug myjob-abcde --target worker // after: target the live deployment pod slim debug myapp-5d7f8c6b9-x2klm --target app
Defensive patterns
Strategy: validation
Validate before calling
phase=$(kubectl get pod myapp-pod -o jsonpath='{.status.phase}')
[ "$phase" = "Running" ] || echo "pod phase is $phase — aborting debug" Try / catch
if err := runDebug(target); err != nil && strings.Contains(err.Error(), "pod is done") {
// inspect kubectl describe pod for terminal reason
} Prevention
- Only target pods in Running phase
- Avoid debugging completed Job pods — target live ReplicaSet pods
- Fix CrashLoopBackOff before attaching debuggers
When it happens
Trigger: ensurePod's isPodRunning poll callback observes pod.Status.Phase == PodFailed or PodSucceeded during the 2-minute polling window.
Common situations: Debugging a Job/CronJob pod whose container already exited successfully (Succeeded); a CrashLoopBackOff pod that transitions to Failed; pending pod that fails scheduling and reports Failed; short-lived init-job pods.
Related errors
- target container not found
- ephemeral container not found
- Pod terminated
- Pod not running
- Container terminated
AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31).
Data as JSON: /api/errors/9eb4db288589d809.
Report an issue: GitHub.