kubernetes/kops · error

found multiple packages in channel for name=%q

Error message

found multiple packages in channel for name=%q

What it means

GetPackageVersion resolves a package (addon) name to a version from the addons channel. After filtering channel packages by name, if more than one package entry matches, the function cannot determine which version to return and throws this error. The channel spec must contain at most one package entry per name.

Source

Thrown at pkg/apis/kops/channel.go:433

				klog.Warningf("cannot parse KopsVersion=%q", pkg.KopsVersion)
				continue
			}

			if !kopsVersion.IsInRange(versionRange) {
				klog.V(2).Infof("kOps version %q does not match range: %s", kopsVersion, pkg.KopsVersion)
				continue
			}
		}

		matches = append(matches, pkg)
	}

	if len(matches) == 0 {
		return nil, fmt.Errorf("found no packages in channel for name=%q", name)
	}

	if len(matches) != 1 {
		return nil, fmt.Errorf("found multiple packages in channel for name=%q", name)
	}
	v, err := util.ParseVersion(matches[0].Version)
	if err != nil {
		return nil, fmt.Errorf("error parsing version %q for package %q", matches[0].Version, name)
	}
	return v, nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Open the channel YAML used by the cluster and remove/merge duplicate package entries with the same name
  2. If entries differ intentionally, rename or remove the obsolete addon entry so each name is unique
  3. Regenerate or re-download the official kOps channel file instead of a hand-edited copy

Example fix

# before (channel.yaml)
addons:
  packages:
    - name: kopsUrl
      version: 1.28.0
    - name: kopsUrl
      version: 1.27.0
# after
addons:
  packages:
    - name: kopsUrl
      version: 1.28.0
Defensive patterns

Strategy: validation

Validate before calling

func validateUniquePackageNames(channel *kops.Addons) error {
    seen := map[string]bool{}
    for _, p := range channel.Spec.Packages {
        if seen[p.Name] {
            return fmt.Errorf("duplicate package %q in channel", p.Name)
        }
        seen[p.Name] = true
    }
    return nil
}

Prevention

When it happens

Trigger: Calling GetPackageVersion (indirectly via CreateAddons during cluster apply/update) when the addons ChannelSpec contains two or more <name> package entries with the same name under addons.spec.packages (or via duplicate entries merged from channel overrides).

Common situations: Hand-edited or forked addons channel YAML with duplicated package entries; merging multiple channel sources that both define the same addon name; a typo making one entry collide with another name after lowercasing.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/6baa49fe09de8af4. Report an issue: GitHub.