Skip to content
Latchkey

Crossplane "cannot compose resources" in CI

"cannot compose resources" is the top-level error the composite controller reports when it fails to expand an XR into its managed resources. The specific failure - a broken function, a bad patch, or an invalid template - follows in the same message.

What this error means

An XR shows SYNCED False with a ReconcileError and an event containing "cannot compose resources:" followed by the underlying cause.

crossplane
cannot compose resources: cannot render composed resource from resource template
at index 0: cannot unmarshal JSON from patch at index 1 into *v1.Bucket

Common causes

A patch or template produces an invalid resource

A patch writes an incompatible value or the base template is malformed, so the composed resource cannot be rendered.

The function pipeline returns an error

A composition function in the pipeline fails, and the controller surfaces it as a failure to compose resources.

How to fix it

Reproduce with render and fix the template

  1. Run crossplane beta render on the XR and composition to see the failing resource locally.
  2. Correct the base template or the patch that produces the bad value.
  3. Re-apply and confirm the XR reaches SYNCED True.
Terminal
crossplane beta render xr.yaml composition.yaml functions.yaml

Inspect the composite events for the real cause

Read the events on the XR to find the underlying function or patch error behind "cannot compose resources".

Terminal
kubectl describe xstorage my-xr | sed -n '/Events/,$p'

How to prevent it

  • Render compositions in PR so template and patch errors surface before apply.
  • Validate patch value types against the target CRD schema.
  • Keep composition functions pinned and healthy before reconciling XRs.

Frequently asked questions

What causes ""cannot compose resources""?
A patch writes an incompatible value or the base template is malformed, so the composed resource cannot be rendered.
How do I fix "cannot compose resources"?
Reproduce with render and fix the template

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card