slimtoolkit/slim · error

found more than 1 workload '%s/%s' match in the supplied man

Error message

found more than 1 workload '%s/%s' match in the supplied manifests

What it means

Manifests.Find looks up a workload (namespace/name) in the set of loaded Kubernetes manifests. If more than one resource info matches the target namespace and name, the lookup is ambiguous and Find returns this error instead of guessing. It protects against applying/inspecting the wrong workload.

Source

Thrown at pkg/app/master/kubernetes/manifests.go:94

	for _, info := range ms.infos {
		if info.Mapping.GroupVersionKind.GroupKind() != mapping.GroupVersionKind.GroupKind() {
			continue
		}
		if info.Name != name {
			continue
		}
		if target.Namespace != "" && target.Namespace != info.Namespace {
			continue
		}

		matches = append(matches, info)
	}

	if len(matches) == 0 {
		return nil, nil
	}
	if len(matches) > 1 {
		return nil, fmt.Errorf("found more than 1 workload '%s/%s' match in the supplied manifests", target.Namespace, name)
	}

	return matches[0], nil
}

func (ms *Manifests) Apply(ctx context.Context, predicate func(info *resource.Info) bool) error {
	for _, info := range ms.infos {
		if !predicate(info) {
			continue
		}

		if err := ms.client.CreateOrUpdate(ctx, info); err != nil {
			// TODO: consider partial applying
			return err
		}
	}

	return nil

View on GitHub (pinned to 81940d17fa)

Solutions

  1. Remove or rename the duplicate workload definitions so namespace/name is unique across all supplied manifests.
  2. Check which files contain duplicates: kubectl get -f <files> or grep for the workload name/kind.
  3. Narrow the manifest set passed to slim to only the files needed for the target workload.
  4. Qualify the target with an explicit namespace so matching is unambiguous.

Example fix

# before: duplicates across files
slim k8s --target-deployment app --manifests base.yaml,overlay.yaml  # both define default/app
# after: single source of truth
slim k8s --target-deployment app --manifests rendered.yaml
Defensive patterns

Strategy: validation

Validate before calling

// ensure namespace/name is unique across supplied manifests before Find
names := map[string]int{}
for _, info := range infos {
    key := info.Namespace + "/" + info.Name
    names[key]++
    if names[key] > 1 {
        log.Fatalf("duplicate workload %s in supplied manifests", key)
    }
}

Try / catch

w, err := manifests.Find(ctx, ns, name)
if err != nil && strings.Contains(err.Error(), "found more than 1 workload") {
    return fmt.Errorf("deduplicate %s/%s across --manifests files: %w", ns, name, err)
}

Prevention

When it happens

Trigger: Calling Find with a target whose namespace/name appears in multiple resources across the supplied manifest files (or duplicates within one file) — e.g. the same Deployment defined twice, or manifests merged from overlapping files.

Common situations: Passing several manifest files that each define the same workload; copy-pasted resources across overlays; kustomize output where a workload is duplicated across bases and patches; targeting by name in manifests with same-name resources in namespaces that got flattened.

Related errors


AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31). Data as JSON: /api/errors/63ccc7c5a786f1e9. Report an issue: GitHub.