{"record":{"id":"bee350a5a593f23d","repo":"slimtoolkit/slim","slug":"pod-not-running","errorCode":null,"errorMessage":"Pod not running","messagePattern":"Pod not running","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/master/command/debug/handle_kubernetes_runtime.go","lineNumber":1000,"sourceCode":"\t}\n\n\terr := wait.PollImmediate(2*time.Second, 2*time.Minute, isPodRunning)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\treturn outputPod, podName, nil\n}\n\nconst (\n\tctInit      = \"init\"\n\tctStandard  = \"standard\"\n\tctEphemeral = \"ephemeral\"\n)\n\nvar (\n\tErrPodTerminated       = errors.New(\"Pod terminated\")\n\tErrPodNotRunning       = errors.New(\"Pod not running\")\n\tErrContainerTerminated = errors.New(\"Container terminated\")\n)\n\nfunc waitForContainer(\n\tlogger *log.Entry,\n\txc *app.ExecutionContext,\n\tctx context.Context,\n\tapi *kubernetes.Clientset,\n\tnsName string,\n\tpodName string,\n\tcontainerName string,\n\tcontainerType string) error {\n\tlogger.Tracef(\"waitForContainer(%s,%s,%s,%s)\", nsName, podName, containerName, containerType)\n\n\tisContainerRunning := func() (bool, error) {\n\t\tpod, err := api.CoreV1().Pods(nsName).Get(ctx, podName, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn false, err","sourceCodeStart":982,"sourceCodeEnd":1018,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/master/command/debug/handle_kubernetes_runtime.go#L982-L1018","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Wait until the pod reports Running (kubectl wait --for=condition=Ready pod/<name>) then retry","Check pod events (kubectl describe pod) for scheduling/image-pull problems and fix those first","Target a different, already-running pod for debugging"],"exampleFix":"kubectl wait --for=condition=Ready pod/my-pod --timeout=120s\n# then re-run the debug command","handlingStrategy":"retry","validationCode":"err := wait.PollImmediate(2*time.Second, 2*time.Minute, func() (bool, error) {\n\tp, _ := clientset.CoreV1().Pods(ns).Get(ctx, name, metav1.GetOptions{})\n\treturn p.Status.Phase == corev1.PodRunning, nil\n})","typeGuard":null,"tryCatchPattern":"// Go\nif errors.Is(err, ErrPodNotRunning) {\n\t// wait for readiness then retry the debug operation\n}","preventionTips":["Wait for pod Ready condition before debugging","Inspect kubectl describe pod events for scheduling failures","Ensure the cluster has resources so pods actually start"],"tags":["kubernetes","pod","state"],"backgroundTag":"pod-not-running","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}