kustomize patch fails: error: no matches for OriginalId ~G_v1_Deployment|~X|my-app
Routes kustomize patch-target misses. Use when a patch fails with no matches for OriginalId. Not for duplicate-resource or load-restrictor errors.
The patch target (kind/name, and namespace if set) matches nothing in the base - the name or kind is misspelled, the resource is not in the resources list, or a namePrefix already renamed it so the target name no longer exists. Check the base's actual resource names (kustomize build base | grep -E kind/name), fix the target to match, and rebuild.
The error
error: no matches for OriginalId ~G_v1_Deployment|~X|my-appWhat to do
- See what the base actually contains:
kustomize build base | grep -E '^kind:|^ name:'Expected: Lists real kinds and names.
- Compare with the patch target in the overlay's kustomization.yaml.
Expected: Spots the mismatch: typo, wrong kind, or prefixed name.
- Fix the target name/kind (remember namePrefix/nameSuffix rewrite names before patches match).
Expected: Target matches a real resource.
- Rebuild:
kustomize build [overlay]Expected: Patch applies cleanly.
When this applies
- the exact no matches for OriginalId message
- patches written against assumed names
- namePrefix/nameSuffix changing names under patches
When it does NOT apply
- patches that apply but change nothing (target matched, patch is a no-op)
- strategic-merge patches with wrong container names (different failure)
Works with
kustomize 4.x/5.x
error: no matches for Id ... (other id formats)
Same miss, different resource. Same name-check fix.
Why it happens
Patches match against the resource ids produced after name transformers run. A target written for the pre-prefix name, or for a resource that is not in the build, matches nothing.
Edge cases
- Patches in the base vs the overlay see different names when the overlay adds a prefix - target the post-prefix name.
- namespace in the target must also match; a target without namespace matches cluster-scoped or default only.
Resolved from
gh:devsatym/kubernetes-playbook (kustomize patterns) - https://github.com/devsatym/kubernetes-playbook/blob/HEAD/1.cka/11.)%20Helm%20&%20Kustomize/2.Kustomize.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.