{"record":{"id":"3e584155eaccb9fa","repo":"argoproj/argo-workflows","slug":"1","errorCode":"-1","errorMessage":"Could not find wait container in pod spec","messagePattern":"Could not find wait container in pod spec","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/util/util.go","lineNumber":1749,"sourceCode":"\t\treturn false\n\t}\n\n\tif platform, keyExists := nodeSelector[\"kubernetes.io/os\"]; keyExists && platform == \"windows\" {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\nfunc FindWaitCtrIndex(pod *apiv1.Pod) (int, error) {\n\twaitCtrIndex := -1\n\tfor i, ctr := range pod.Spec.Containers {\n\t\tif ctr.Name == common.WaitContainerName {\n\t\t\twaitCtrIndex = i\n\t\t}\n\t}\n\tif waitCtrIndex == -1 {\n\t\terr := errors.Errorf(\"-1\", \"Could not find wait container in pod spec\")\n\t\treturn -1, err\n\t}\n\treturn waitCtrIndex, nil\n}\n\n// FindAuxiliaryCtrIndex returns the index of the auxiliary executor container\n// on the pod — wait in the legacy layout, supervisor in the init-less layout.\n// Returns -1 and an error if neither is found.\nfunc FindAuxiliaryCtrIndex(pod *apiv1.Pod) (int, error) {\n\tfor i, ctr := range pod.Spec.Containers {\n\t\tif ctr.Name == common.WaitContainerName || ctr.Name == common.SupervisorContainerName {\n\t\t\treturn i, nil\n\t\t}\n\t}\n\treturn -1, errors.Errorf(\"-1\", \"Could not find wait or supervisor container in pod spec\")\n}\n","sourceCodeStart":1731,"sourceCodeEnd":1766,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/util/util.go#L1731-L1766","documentation":"GetWaitContainerIndex scans pod.Spec.Containers for the Argo 'wait' container and returns -1 with this error when none is found. Every legacy workflow pod must include the wait sidecar, which performs artifact/output capture; its absence means the pod is not a valid Argo workflow pod for the legacy layout.","triggerScenarios":"Calling GetWaitContainerIndex on a pod built without the wait container: init-less (emissary/supervisor) pods that lack the legacy wait sidecar, hand-edited pod specs, pods whose wait container was removed by a mutating webhook or admission policy.","commonSituations":"Running with the init-less/supervisor container runtime (SOCKS5/emissary mode) while code still expects the legacy wait container; cluster policies (e.g. Istio sidecar injection policies or security controllers) stripping containers; users manually editing generated pod manifests.","solutions":["If running the init-less/emissary runtime, use FindAuxiliaryCtrIndex instead, which matches both wait and supervisor containers","Verify the workflow pod template still includes common.WaitContainerName in spec.containers","Check whether an admission webhook or security policy is removing containers from workflow pods","Ensure you are not inspecting a non-workflow pod (plain k8s pod without Argo executor setup)"],"exampleFix":"// before\nidx, err := util.GetWaitContainerIndex(pod)\n// after (works for both legacy and init-less pods)\nidx, err := util.FindAuxiliaryCtrIndex(pod)","handlingStrategy":"validation","validationCode":"func hasWaitContainer(pod *apiv1.Pod) bool {\n    for _, c := range pod.Spec.Containers {\n        if c.Name == common.WaitContainerName {\n            return true\n        }\n    }\n    return false\n}","typeGuard":"func isLegacyWorkflowPod(pod *apiv1.Pod) bool {\n    _, found := pod.Labels[common.LabelKeyWorkflow]\n    return found && hasWaitContainer(pod)\n}","tryCatchPattern":"idx, err := util.GetWaitContainerIndex(pod)\nif err != nil {\n    // fall back to init-less layout\n    if idx2, err2 := util.FindAuxiliaryCtrIndex(pod); err2 == nil {\n        idx = idx2\n    } else {\n        return fmt.Errorf(\"no executor container in pod %s: %w\", pod.Name, err)\n    }\n}","preventionTips":["Use FindAuxiliaryCtrIndex to cover both legacy and init-less pods","Check controller container-runtime executor config (emissary vs legacy) before inspecting pods","Audit admission webhooks for container stripping","Verify pod is a workflow pod via labels before indexing containers"],"tags":["kubernetes","pod-spec","wait-container","argoexec"],"backgroundTag":"wait-container-missing","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}