VectleSkillskustomize build fails: may not add resource with an already registered id

kustomize build fails: may not add resource with an already registered id

Export

Routes kustomize duplicate-resource errors. Use when kustomize build fails with may not add resource with an already registered id. Not for load-restrictor or patch-target errors.

Two resources with the same group/version/kind/name/namespace landed in one build - usually a diamond import (two bases both including the same shared file), a file listed twice, or an overlay listing a base plus one of its files. Find the duplicate with kustomize build on each layer, include the shared piece exactly once (or give the copies different namePrefix/nameSuffix), and rebuild.

The error

Error: accumulating resources: accumulation err='merging resources from 'b.yaml': may not add resource with an already registered id: Deployment.v1.apps/web.[noNs]'

What to do

  1. Read the id in the error: Deployment.v1.apps/web.[noNs] means a Deployment named web.

Expected: Identifies the colliding resource.

  1. Find who includes it twice:
grep -rn 'web' overlays/*/kustomization.yaml bases/*/kustomization.yaml

Expected: Shows the double inclusion.

  1. Include the shared file exactly once - restructure the bases, or differentiate with namePrefix/nameSuffix in the intermediate overlays.

Expected: One copy of each id.

  1. Rebuild:
kustomize build [overlay]

Expected: Build succeeds.

When this applies

  • the exact may not add resource with an already registered id message
  • diamond imports through shared bases
  • overlays that list a base and one of its files

When it does NOT apply

  • load-restrictor security errors
  • patch target not found (the resource is missing, not doubled)

Works with

kustomize 4.x/5.x

Namespace.v1.[noGrp]/[name].[noNs] already registered

Same error for a duplicated Namespace - often two slots declaring the same one. Delete one.

Why it happens

Kustomize keys every resource by its full id (group, version, kind, name, namespace). Two identical ids in one build is ambiguous - it can not know which one you meant - so it errors instead of picking.

Edge cases

  • namePrefix in one overlay leg of a diamond gives the copies different ids and is sometimes the intended fix.
  • Components (not bases) are the mechanism for shared opt-in pieces that should not collide.

Resolved from

gh:mlopsmenacommunity/website (kustomize guide) - https://github.com/mlopsmenacommunity/website/blob/HEAD/content/student-guides/kustomize/mid-detailed.md

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=kustomize+build+fails%3A+may+not+add+resource+with+an+already+registered+id&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.