{"record":{"id":"4196a71c5ac24af9","repo":"kubernetes/kops","slug":"unknown-phase-q-available-phases-s","errorCode":null,"errorMessage":"unknown phase %q, available phases: %s","messagePattern":"unknown phase %q, available phases: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/update_cluster.go","lineNumber":318,"sourceCode":"\t\terr = sshCredentialStore.AddSSHPublicKey(ctx, authorized)\n\t\tif err != nil {\n\t\t\treturn results, fmt.Errorf(\"error adding SSH public key: %v\", err)\n\t\t}\n\n\t\tklog.Infof(\"Using SSH public key: %v\\n\", c.SSHPublicKey)\n\t}\n\n\tvar phase cloudup.Phase\n\tif c.Phase != \"\" {\n\t\tswitch strings.ToLower(c.Phase) {\n\t\tcase string(cloudup.PhaseNetwork):\n\t\t\tphase = cloudup.PhaseNetwork\n\t\tcase string(cloudup.PhaseSecurity), \"iam\": // keeping IAM for backwards compatibility\n\t\t\tphase = cloudup.PhaseSecurity\n\t\tcase string(cloudup.PhaseCluster):\n\t\t\tphase = cloudup.PhaseCluster\n\t\tdefault:\n\t\t\treturn results, fmt.Errorf(\"unknown phase %q, available phases: %s\", c.Phase, strings.Join(cloudup.Phases.List(), \",\"))\n\t\t}\n\t}\n\n\tdeletionProcessing := fi.DeletionProcessingModeDeleteIfNotDeferrred\n\tif c.Prune {\n\t\tdeletionProcessing = fi.DeletionProcessingModeDeleteIncludingDeferred\n\t}\n\n\tlifecycleOverrideMap := make(map[string]fi.Lifecycle)\n\n\tfor _, override := range c.LifecycleOverrides {\n\t\tvalues := strings.Split(override, \"=\")\n\t\tif len(values) != 2 {\n\t\t\treturn results, fmt.Errorf(\"incorrect syntax for lifecyle-overrides, correct syntax is TaskName=lifecycleName, override provided: %q\", override)\n\t\t}\n\n\t\ttaskName := values[0]\n\t\tlifecycleName := values[1]","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/update_cluster.go#L300-L336","documentation":"`kops update cluster --phase` restricts the update to a single phase. RunUpdateCluster validates the value against the known cloudup phases (network, security/iam, cluster); anything else, including typos and unknown aliases, triggers this error listing the valid phases.","triggerScenarios":"`kops update cluster --phase <value>` where <value> is not one of: \"network\", \"security\", \"iam\" (legacy alias), or \"cluster\" — e.g. --phase infrastructure, --phase Network (wrong case), or an empty/mistyped value.","commonSituations":"Copy-pasting phase names from old kOps docs or other tools; capitalization mismatch; assuming phases like 'validate' or 'dns' are selectable; scripts written for kOps versions with different phase sets.","solutions":["Use one of the listed phases: network, security (or iam), cluster","Fix capitalization — phase strings are lowercase","Split multi-phase work into sequential invocations (network, then security, then cluster) instead of inventing a phase name","Run `kops update cluster --help` to see the phases supported by your kOps version"],"exampleFix":"// before\nkops update cluster c.k8s.local --phase Infrastructure --yes\n// after\nkops update cluster c.k8s.local --phase network --yes\nkops update cluster c.k8s.local --phase security --yes","handlingStrategy":"validation","validationCode":"valid := map[string]bool{\"network\": true, \"security\": true, \"iam\": true, \"cluster\": true, \"\": true}\nif !valid[c.Phase] {\n\treturn fmt.Errorf(\"--phase %q invalid; use network|security|iam|cluster\", c.Phase)\n}\n_ = runUpdateCluster(c)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store phase names as constants/lowercase variables in scripts","Check `kops update cluster --help` for the phase list of the installed version","Treat 'iam' as a legacy alias — prefer 'security'","Never invent phase names for multi-phase flows; chain separate invocations"],"tags":["cli","flag-validation","phase"],"backgroundTag":"invalid-enum-value","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}