derailed/k9s · warning

unable to assert CRD servers versions for %s

Error message

unable to assert CRD servers versions for %s

What it means

CustomResourceDefinition.diagnose flags a CRD whose spec.versions slice is empty. The API server normally guarantees at least one version, so encountering this means a malformed or exotic CRD object (or a stale cache entry), not ordinary operation.

Source

Thrown at internal/render/crd.go:101

	r.ID = client.MetaFQN(&crd.ObjectMeta)
	r.Fields = model1.Fields{
		crd.Spec.Names.Plural,
		crd.Spec.Group,
		crd.Spec.Names.Kind,
		naStrings(versions),
		string(crd.Spec.Scope),
		naStrings(crd.Spec.Names.ShortNames),
		mapToStr(crd.GetLabels()),
		AsStatus(c.diagnose(crd.Name, crd.Spec.Versions)),
		ToAge(crd.GetCreationTimestamp()),
	}

	return nil
}

func (CustomResourceDefinition) diagnose(n string, vv []v1.CustomResourceDefinitionVersion) error {
	if len(vv) == 0 {
		return fmt.Errorf("unable to assert CRD servers versions for %s", n)
	}

	var (
		ee     []error
		served bool
	)
	for _, v := range vv {
		if v.Served {
			served = true
		}
		if v.Deprecated {
			if v.DeprecationWarning != nil {
				ee = append(ee, fmt.Errorf("%s", *v.DeprecationWarning))
			} else {
				ee = append(ee, fmt.Errorf("%s[%s] is deprecated", n, v.Name))
			}
		}
	}

View on GitHub (pinned to 2d3ccc6ba2)

Solutions

  1. Inspect the object: kubectl get crd <name> -o yaml and check spec.versions
  2. Re-apply or patch the CRD with at least one version (served: true)
  3. Delete and recreate the CRD if its definition is corrupt
  4. Refresh the k9s view to drop stale cache entries

Example fix

# before: spec.versions: []
# after
spec:
  versions:
  - name: v1
    served: true
    storage: true
Defensive patterns

Strategy: validation

Validate before calling

if len(crd.Spec.Versions) == 0 {
	// skip / quarantine this CRD object instead of diagnosing
	return
}

Try / catch

Treat the diagnose error as display data (row status); optionally re-fetch the CRD once to bypass a stale cache before trusting it.

Prevention

When it happens

Trigger: A CRD applied through non-validating paths (direct etcd edit, buggy operators) with versions: []; a cached informer object from an interrupted CRD replacement.

Common situations: Operator or CRD-controller bugs emitting incomplete CRDs; tooling that patches spec.versions to an empty list; viewing a CRD mid-deletion.

Related errors


AI-assisted analysis of derailed/k9s@2d3ccc6ba2 (2026-08-15). Data as JSON: /api/errors/f635d53431d8ce5b. Report an issue: GitHub.