slimtoolkit/slim · error

no pods

Error message

no pods

What it means

ensurePod resolves the target pod. With no explicit pod name it lists pods in the namespace and takes the first; if the namespace contains zero pods it fails with 'no pods'. Nothing is running in the selected namespace for the tool to debug.

Solutions

  1. Pass the pod name explicitly to the command instead of relying on auto-detection.
  2. Confirm with `kubectl get pods -n <ns>` that pods actually exist in that namespace.
  3. Scale the workload back up (`kubectl scale deploy/<name> --replicas=1`) before debugging.
  4. Switch to the correct namespace/cluster context via KUBECONFIG.

Example fix

// before: empty namespace fallback
slim debug <target> --namespace default
// after
slim debug myapp-5d7f8c6b9-x2klm --namespace production
Defensive patterns

Strategy: validation

Validate before calling

ns=production
[ "$(kubectl get pods -n "$ns" --field-selector=status.phase=Running -o name | wc -l)" -gt 0 ] || echo "no running pods in $ns"

Try / catch

if err := runDebug(target); err != nil && strings.Contains(err.Error(), "no pods") {
    // check namespace/scale and retry
}

Prevention

When it happens

Trigger: HandleKubernetesRuntime / listDebuggableK8sContainersWithConfig / listK8sDebugContainersWithConfig call ensurePod with a namespace whose Pods().List returns an empty Items slice.

Common situations: Wrong namespace (workload lives in 'production' but you are in 'default'); all pods crashed/completed and were garbage-collected; deployments scaled to 0; kubeconfig pointing at an empty cluster.

Related errors


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

Appendix: source

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

	var list []string
	for _, status := range input {
		if status.State.Running != nil || status.State.Waiting != nil {
			list = append(list, status.Name)
		}
	}

	return list
}

func ensurePod(ctx context.Context, api *kubernetes.Clientset, nsName string, podName string) (*corev1.Pod, string, error) {
	if podName == "" {
		pods, err := api.CoreV1().Pods(nsName).List(ctx, metav1.ListOptions{})
		if err != nil {
			return nil, "", err
		}

		if len(pods.Items) == 0 {
			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")

View on GitHub (pinned to 81940d17fa)