{"record":{"id":"61d94be5bc4dfdd6","repo":"GoogleContainerTools/skaffold","slug":"unknown-phase-s","errorCode":null,"errorMessage":"unknown phase: %s","messagePattern":"unknown phase: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/kubernetes/wait.go","lineNumber":98,"sourceCode":"\t\tpod, isPod := event.Object.(*v1.Pod)\n\t\tif !isPod {\n\t\t\treturn false, nil\n\t\t}\n\t\tif pod.Name != podName {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tswitch pod.Status.Phase {\n\t\tcase v1.PodSucceeded:\n\t\t\treturn true, nil\n\t\tcase v1.PodRunning:\n\t\t\treturn false, nil\n\t\tcase v1.PodFailed:\n\t\t\treturn false, errors.New(\"pod has failed\")\n\t\tcase v1.PodUnknown, v1.PodPending:\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, fmt.Errorf(\"unknown phase: %s\", pod.Status.Phase)\n\t}\n}\n\n// WaitForPodInitialized waits until init containers have started running\nfunc WaitForPodInitialized(ctx context.Context, pods corev1.PodInterface, podName string) error {\n\tlog.Entry(ctx).Infof(\"Waiting for %s to be initialized\", podName)\n\n\tw, err := newPodsWatcher(ctx, pods)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"initializing pod watcher: %s\", err)\n\t}\n\tdefer w.Stop()\n\n\treturn watchUntilTimeout(ctx, 10*time.Minute, w, func(event *watch.Event) (bool, error) {\n\t\tif event.Object == nil {\n\t\t\treturn false, nil\n\t\t}\n","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/kubernetes/wait.go#L80-L116","documentation":"The pod watcher received a pod whose Status.Phase is not one of Succeeded, Failed, Unknown, or Pending — the isPodSucceeded predicate treats any other phase as an unknown enum value and errors with 'unknown phase: %s'. This guards against newer Kubernetes phase values the running code doesn't understand.","triggerScenarios":"During WaitForPodSucceeded's watch, an event delivers a pod whose phase string (e.g. a phase introduced by a newer API server or an unusual distribution) doesn't match any known v1.Pod constant handled in the switch.","commonSituations":"Skaffold binary built against an older k8s.io/api version talking to a newer cluster that reports a phase constant unknown to it; running against a non-standard Kubernetes-compatible distribution; a mocked/fake client emitting a bogus phase.","solutions":["Upgrade skaffold to the latest version so its k8s.io/api library knows the phase your cluster reports","Pin/downgrade the cluster or use a standard Kubernetes distribution if a nonstandard phase is being emitted","Inspect the reported phase value and file an issue if it's a legit new Kubernetes phase","If it comes from a test fake, fix the fake to emit valid corev1.PodPhase values"],"exampleFix":"// before: k8s client lib too old for cluster phase\n// after\n// upgrade dependency:\ngo get k8s.io/api@latest k8s.io/client-go@latest\ngo build ./...","handlingStrategy":"type-guard","validationCode":"// ensure only known phases reach the wait predicate\nfunc knownPhase(p corev1.Pod) bool {\n    switch p.Status.Phase {\n    case corev1.PodSucceeded, corev1.PodFailed, corev1.PodUnknown, corev1.PodPending, corev1.PodRunning:\n        return true\n    }\n    return false\n}","typeGuard":"func isKnownPodPhase(p *corev1.Pod) bool {\n    switch p.Status.Phase {\n    case corev1.PodPending, corev1.PodRunning, corev1.PodSucceeded, corev1.PodFailed, corev1.PodUnknown:\n        return true\n    default:\n        return false\n    }\n}","tryCatchPattern":"err := kubernetes.WaitForPodSucceeded(ctx, pods, podName, timeout)\nif err != nil && strings.HasPrefix(err.Error(), \"unknown phase\") {\n    log.Printf(\"cluster reported a phase this skaffold doesn't know; upgrade skaffold: %v\", err)\n}","preventionTips":["Keep skaffold and its k8s.io/api dependency current relative to your cluster version","Use standard Kubernetes distributions that emit standard PodPhase values","Fix test fakes to emit valid corev1.PodPhase constants","Track Kubernetes release notes for new pod phases before upgrading clusters"],"tags":["kubernetes","pod","watch"],"backgroundTag":"invalid-enum-value","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"}