{"record":{"id":"18cbe2edb482a843","repo":"GoogleContainerTools/skaffold","slug":"statuscheck-pod-initializing","errorCode":"STATUSCHECK_POD_INITIALIZING","errorMessage":"waiting for init container %s to start","messagePattern":"waiting for init container (.+?) to start","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/diag/validator/validator.go","lineNumber":153,"sourceCode":"\t// If the event type PodScheduled with status False is found then we check if it is due to taints and tolerations.\n\tif c, ok := isPodNotScheduled(pod); ok {\n\t\tlog.Entry(context.TODO()).Debugf(\"Pod %q not scheduled: checking tolerations\", pod.Name)\n\t\tsc, err := getUntoleratedTaints(c.Reason, c.Message)\n\t\treturn sc, nil, err\n\t}\n\t// we can check the container status if the pod has been scheduled successfully. This can be determined by having the event\n\t// PodScheduled with status True, or a ContainerReady or PodReady event with status False.\n\tif isPodScheduledButNotReady(pod) {\n\t\tlog.Entry(context.TODO()).Debugf(\"Pod %q scheduled but not ready: checking container statuses\", pod.Name)\n\t\t// TODO(dgageot): Add EphemeralContainerStatuses\n\t\tcs := append(pod.Status.InitContainerStatuses, pod.Status.ContainerStatuses...)\n\t\t// See https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-states\n\t\tstatusCode, logs, err := getContainerStatus(pod, cs)\n\t\tif statusCode == proto.StatusCode_STATUSCHECK_POD_INITIALIZING {\n\t\t\t// Determine if an init container is still running and fetch the init logs.\n\t\t\tfor _, c := range pod.Status.InitContainerStatuses {\n\t\t\t\tif c.State.Waiting != nil {\n\t\t\t\t\treturn statusCode, []string{}, fmt.Errorf(\"waiting for init container %s to start\", c.Name)\n\t\t\t\t} else if c.State.Running != nil {\n\t\t\t\t\tsc, l := getPodLogs(pod, c.Name, statusCode)\n\t\t\t\t\treturn sc, l, fmt.Errorf(\"waiting for init container %s to complete\", c.Name)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn statusCode, logs, err\n\t}\n\n\tif c, ok := isPodStatusUnknown(pod); ok {\n\t\tlog.Entry(context.TODO()).Debugf(\"Pod %q condition status of type %s is unknown\", pod.Name, c.Type)\n\t\treturn proto.StatusCode_STATUSCHECK_UNKNOWN, nil, errors.New(c.Message)\n\t}\n\n\tlog.Entry(context.TODO()).Debugf(\"Unable to determine current service state of pod %q\", pod.Name)\n\treturn proto.StatusCode_STATUSCHECK_UNKNOWN, nil, fmt.Errorf(\"unable to determine current service state of pod %q\", pod.Name)\n}\n","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/diag/validator/validator.go#L135-L171","documentation":"This pod-status error (code STATUSCHECK_POD_INITIALIZING) means the pod is still in the initializing phase because one of its init containers is stuck in Waiting state (not yet started). Skaffold raises it while probing container statuses so the user knows initialization has not completed.","triggerScenarios":"getPodStatus detects statusCode STATUSCHECK_POD_INITIALIZING and finds an entry in pod.Status.InitContainerStatuses whose State.Waiting is non-nil, returning 'waiting for init container <name> to start'.","commonSituations":"Init container image stuck in ImagePullBackOff; init container command misconfigured; pod waiting on initContainer dependencies (service mesh, secrets, volume setup); cluster DNS/registry issues blocking image pull.","solutions":["Run kubectl describe pod <name> and inspect the init container's Waiting reason (ErrImagePull/CrashLoopBackOff) and fix that root cause.","Fix the init container image reference or registry credentials (imagePullSecrets) if it cannot be pulled.","If the init container depends on an external service, verify that service is reachable before/at pod start.","Increase kubectl logs <pod> -c <init-container> output to confirm where the init step is hanging, and fix the command or its dependencies."],"exampleFix":"# before: init container references a private image without credentials\n// after: attach pull secret to the pod spec\n// imagePullSecrets:\n// - name: regcred","handlingStrategy":"validation","validationCode":"pod, _ := client.CoreV1().Pods(ns).Get(ctx, name, metav1.GetOptions{}); for _, ic := range pod.Status.InitContainerStatuses { if ic.State.Waiting != nil { return fmt.Errorf(\"init container %s not started: %s %s\", ic.Name, ic.State.Waiting.Reason, ic.State.Waiting.Message) } }","typeGuard":"func initContainerStarted(pod *v1.Pod) bool { for _, c := range pod.Status.InitContainerStatuses { if c.State.Waiting != nil || c.State.Terminated != nil && c.State.Terminated.ExitCode != 0 { return false } } return true }","tryCatchPattern":null,"preventionTips":["Keep init containers tiny and give them timeout+failure exits","Pre-pull init container images (same base as app image)","Test initContainer dependencies (DB, mesh) exist before deploying","Use kubectl describe pod to check Waiting reasons during CI"],"tags":["kubernetes","pod","init-container","status-check"],"backgroundTag":"pod-stuck-initializing","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}