GoogleContainerTools/skaffold · error

could not find resource for %s

Error message

could not find resource for %s

What it means

After successfully listing server resources for the GVK's group version, GroupVersionResource scans the returned APIResources for one whose Kind matches. If no resource with that Kind exists in the group version, this error is thrown with the GVK string. It means the API group/version exists but does not expose the expected Kind.

Source

Thrown at pkg/skaffold/deploy/util/util.go:175

// GroupVersionResource returns the first `GroupVersionResource` for the given `GroupVersionKind`.
func GroupVersionResource(disco discovery.DiscoveryInterface, gvk schema.GroupVersionKind) (bool, schema.GroupVersionResource, error) {
	resources, err := disco.ServerResourcesForGroupVersion(gvk.GroupVersion().String())
	if err != nil {
		return false, schema.GroupVersionResource{}, fmt.Errorf("getting server resources for group version: %w", err)
	}

	for _, r := range resources.APIResources {
		if r.Kind == gvk.Kind {
			return r.Namespaced, schema.GroupVersionResource{
				Group:    gvk.Group,
				Version:  gvk.Version,
				Resource: r.Name,
			}, nil
		}
	}

	return false, schema.GroupVersionResource{}, fmt.Errorf("could not find resource for %s", gvk.String())
}

func GetManifestsFromHydratedManifests(ctx context.Context, hydratedManifests []string) (manifest.ManifestList, error) {
	var manifests manifest.ManifestList
	for _, path := range hydratedManifests {
		f, err := os.Open(path)
		if err != nil {
			return nil, fmt.Errorf("opening hydrated manifest at %s: %w", path, err)
		}
		defer f.Close()
		ms, err := manifest.Load(f)
		if err != nil {
			return nil, fmt.Errorf("parsing manifests file into manifest list object: %w", err)
		}
		manifests = append(manifests, ms...)
	}

	return manifests, nil

View on GitHub (pinned to a1189de023)

Solutions

  1. Confirm the exact Kind name with kubectl api-resources --api-group=<group> and fix any typo
  2. Ensure the CRD is installed: kubectl get crd and apply the CRD manifest before deploying
  3. Check the GVK's group/version is the one that actually serves the Kind
  4. Handle case-sensitivity: Kind must match exactly (e.g. Deployment, not deployment)

Example fix

// before
return false, schema.GroupVersionResource{}, fmt.Errorf("could not find resource for %s", gvk.String())
// after
return false, schema.GroupVersionResource{}, fmt.Errorf("could not find resource for %s", gvk.String())
Defensive patterns

Strategy: validation

Validate before calling

func assertKindExists(ctx context.Context, disco discovery.DiscoveryInterface, gvk schema.GroupVersionKind) error {
	list, err := disco.ServerResourcesForGroupVersion(gvk.GroupVersion().String())
	if err != nil {
		return err
	}
	for _, r := range list.APIResources {
		if r.Kind == gvk.Kind {
			return nil
		}
	}
	return fmt.Errorf("kind %q not served by %s — apply CRDs first", gvk.Kind, gvk.GroupVersion())
}

Try / catch

ok, gvr, err := GroupVersionResource(disco, gvk)
if err != nil {
	if strings.Contains(err.Error(), "could not find resource for") {
		return fmt.Errorf("kind %s not found — is the CRD installed on this cluster?", gvk.Kind)
	}
	return err
}

Prevention

When it happens

Trigger: Calling GroupVersionResource with a GVK whose Kind is misspelled, whose Kind exists only under a different group/version, or a CRD that is not installed so the discovery list contains no matching Kind.

Common situations: Typo in Kind in the generated client config; using v1 instead of v1beta1 (or vice versa) where the Kind name differs; CRDs not yet applied to the cluster when the deployer runs.

Related errors


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/11c0e2faedcabdd6. Report an issue: GitHub.