{"record":{"id":"c0ffd4c7f4f191e3","repo":"kubernetes/kops","slug":"parsing-taint-q-for-q-w","errorCode":null,"errorMessage":"parsing taint %q for %q: %w","messagePattern":"parsing taint %q for %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/template_functions_karpenter.go","lineNumber":427,"sourceCode":"\tlabels = karpenterNodePoolTemplateLabels(labels)\n\n\ttemplate := karpenterNodeClaimTemplate{\n\t\tSpec: karpenterNodeClaimSpec{\n\t\t\tRequirements: tf.karpenterRequirements(ig),\n\t\t\tNodeClassRef: karpenterNodeClassRef{\n\t\t\t\tGroup: karpenterAWSAPIGroup,\n\t\t\t\tKind:  \"EC2NodeClass\",\n\t\t\t\tName:  ig.Name,\n\t\t\t},\n\t\t},\n\t}\n\tif len(labels) != 0 {\n\t\ttemplate.Metadata = &karpenterNodeClaimMetadata{Labels: labels}\n\t}\n\tfor _, taintSpec := range ig.Spec.Taints {\n\t\ttaint, err := kopsutil.ParseTaint(taintSpec)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"parsing taint %q for %q: %w\", taintSpec, ig.Name, err)\n\t\t}\n\t\ttemplate.Spec.Taints = append(template.Spec.Taints, karpenterTaint{\n\t\t\tKey:    taint[\"key\"],\n\t\t\tValue:  taint[\"value\"],\n\t\t\tEffect: taint[\"effect\"],\n\t\t})\n\t}\n\n\tspec := karpenterNodePoolSpec{\n\t\tTemplate: template,\n\t}\n\tif ig.Spec.MinSize != nil && *ig.Spec.MinSize > 0 {\n\t\tspec.Replicas = new(int64(*ig.Spec.MinSize))\n\t}\n\tif ig.Spec.MaxSize != nil {\n\t\tspec.Limits = &karpenterNodePoolLimits{Nodes: strconv.FormatInt(int64(*ig.Spec.MaxSize), 10)}\n\t}\n","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/template_functions_karpenter.go#L409-L445","documentation":"Each taint in ig.Spec.Taints is parsed with kopsutil.ParseTaint; when a taint string is malformed, buildKarpenterNodePool wraps the parse failure as 'parsing taint %q for %q: %w'. The NodePool manifest cannot be generated until the taint is fixed.","triggerScenarios":"InstanceGroup spec contains a taint not in key=value:effect format (e.g. missing colon, missing effect, empty key) while rendering a Karpenter NodePool.","commonSituations":"Hand-edited cluster spec with typos like 'dedicated=true' (no :effect), 'key=:NoSchedule', or stray whitespace; migrating taints from Kubernetes manifests with a different syntax.","solutions":["Rewrite the taint in canonical form key=value:Effect, e.g. 'dedicated=special:NoSchedule'","Ensure effect is one of NoSchedule, PreferNoSchedule, NoExecute","Check for empty key/value or missing separators in every entry of the instance group's taints list","Validate with `kops get ig <name> -oyaml` and re-run update"],"exampleFix":"// before\ntaints:\n  - dedicated=true\n// after\ntaints:\n  - dedicated=true:NoSchedule","handlingStrategy":"validation","validationCode":"// validate taints before update\nfor _, t := range ig.Spec.Taints {\n\tparts := strings.SplitN(t, \":\", 2)\n\tif len(parts) != 2 || parts[0] == \"\" {\n\t\treturn fmt.Errorf(\"taint %q must be key=value:Effect\", t)\n\t}\n\tif !validEffects[parts[1]] {\n\t\treturn fmt.Errorf(\"taint %q has invalid effect\", t)\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"parsing taint\") {\n\treturn fmt.Errorf(\"correct taint syntax in instance group: %w\", err)\n}","preventionTips":["Always use key=value:Effect with effect in {NoSchedule, PreferNoSchedule, NoExecute}","Copy taints from `kubectl describe node` output verbatim","Lint the cluster spec before `kops update cluster --yes`"],"tags":["kubernetes","taints","karpenter","validation"],"backgroundTag":"invalid-taint-format","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"}