{"record":{"id":"744efe0aeac254db","repo":"kubernetes/kops","slug":"error-too-many-d-in-s","errorCode":null,"errorMessage":"Error too many '=' (%d) in %s","messagePattern":"Error too many '=' \\((.+?)\\) in (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"channels/pkg/cmd/apply_channel.go","lineNumber":91,"sourceCode":"\t\t\treturn runApplyChannelIteration(context.TODO(), f, out, &options, args)\n\t\t},\n\t}\n\n\tcmd.Flags().BoolVar(&options.Yes, \"yes\", false, \"Apply update\")\n\tcmd.Flags().DurationVar(&options.Interval, \"interval\", 0, \"If non-zero, re-apply the channel on this interval until interrupted (e.g. 60s)\")\n\tcmd.Flags().StringVar(&options.NodeName, \"node-name\", \"\", \"If set, patch the named node with the mandatory control-plane labels each iteration; typically supplied via the downward API.\")\n\tcmd.Flags().StringVar(&rawLabels, \"node-labels\", \"\", \"If set, patch the named node with each of the label,value pairs each iteration; typically supplied via the downward API.\")\n\n\treturn cmd\n}\n\nfunc parseLabels(rawLabels string) (map[string]string, error) {\n\tlabels := make(map[string]string)\n\tpairs := strings.Split(rawLabels, \",\")\n\tfor _, rawpair := range pairs {\n\t\tpair := strings.Split(rawpair, \"=\")\n\t\tif len(pair) > 2 {\n\t\t\treturn nil, fmt.Errorf(\"Error too many '=' (%d) in %s\", len(pair), pair)\n\t\t} else if len(pair) == 2 {\n\t\t\tlabels[pair[0]] = pair[1]\n\t\t} else {\n\t\t\tlabels[rawpair] = \"\"\n\t\t}\n\t}\n\treturn labels, nil\n}\n\n// runApplyChannelIteration patches node labels (when --node-name is set) then\n// applies the channel. Labels go first so addons targeting the control-plane\n// label can schedule on the local node as soon as their manifests land.\nfunc runApplyChannelIteration(ctx context.Context, f *ChannelsFactory, out io.Writer, options *ApplyChannelOptions, args []string) error {\n\tvar merr error\n\tif options.NodeName != \"\" {\n\t\tlabelerClient, err := f.KubernetesClient()\n\t\tif err != nil {\n\t\t\tmerr = multierr.Append(merr, fmt.Errorf(\"building kubernetes client for node labeler: %w\", err))","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/channels/pkg/cmd/apply_channel.go#L73-L109","documentation":"parseLabels parses the --node-labels flag value, a comma-separated list of key=value pairs. If any individual pair contains more than one '=' character (i.e. splitting on '=' yields more than 2 parts), it rejects the input because label keys and values cannot themselves contain '='. Note the message prints the whole []string pair with %s, which produces malformed output like [key value=extra].","triggerScenarios":"Running `kops channels --node-name <node> --node-labels \"k=v=w\"` or any flag value where a single comma-separated item contains two or more '=' characters (e.g. a value that was not quoted/escaped, or a stray '=' from shell interpolation).","commonSituations":"Copy-pasting labels with embedded '=' from manifests; shell scripts interpolating variables containing '='; attempting to set a label value with '=' inside (invalid in Kubernetes anyway); typos like 'a=b=c' instead of 'a=b'.","solutions":["Remove the extra '=' from the offending key=value pair so each comma-separated item has at most one '='","If the label value legitimately needs '=', use a Kubernetes-valid encoding (label values only allow alphanumerics, '-', '_', '.')","Check shell quoting/interpolation so an unintended '=' is not injected into --node-labels","Wrap in single quotes so the shell does not split or mangle the value"],"exampleFix":"// before\n--node-labels \"node-role.kubernetes.io/control-plane=,topology.kubernetes.io/zone=us=east-1\"\n// after\n--node-labels \"node-role.kubernetes.io/control-plane=,topology.kubernetes.io/zone=us-east-1\"","handlingStrategy":"validation","validationCode":"func validateLabels(raw string) error {\n\tfor _, item := range strings.Split(raw, \",\") {\n\t\tif strings.Count(item, \"=\") > 1 {\n\t\t\treturn fmt.Errorf(\"label pair %q has more than one '='\", item)\n\t\t}\n\t}\n\treturn nil\n}\n// call before running: validateLabels(nodeLabelsFlag)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote --node-labels values in shell to prevent accidental '=' interpolation","Keep label values Kubernetes-valid: only [A-Za-z0-9], '-', '_', '.'","Split the flag into multiple --node-labels occurrences or comma pairs, never embedded '='","Lint wrapper scripts that build the flag from variables"],"tags":["cli","configuration","parsing","label-validation"],"backgroundTag":"invalid-flag-value","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}