{"record":{"id":"11c0e2faedcabdd6","repo":"GoogleContainerTools/skaffold","slug":"could-not-find-resource-for-s","errorCode":null,"errorMessage":"could not find resource for %s","messagePattern":"could not find resource for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/deploy/util/util.go","lineNumber":175,"sourceCode":"\n// GroupVersionResource returns the first `GroupVersionResource` for the given `GroupVersionKind`.\nfunc GroupVersionResource(disco discovery.DiscoveryInterface, gvk schema.GroupVersionKind) (bool, schema.GroupVersionResource, error) {\n\tresources, err := disco.ServerResourcesForGroupVersion(gvk.GroupVersion().String())\n\tif err != nil {\n\t\treturn false, schema.GroupVersionResource{}, fmt.Errorf(\"getting server resources for group version: %w\", err)\n\t}\n\n\tfor _, r := range resources.APIResources {\n\t\tif r.Kind == gvk.Kind {\n\t\t\treturn r.Namespaced, schema.GroupVersionResource{\n\t\t\t\tGroup:    gvk.Group,\n\t\t\t\tVersion:  gvk.Version,\n\t\t\t\tResource: r.Name,\n\t\t\t}, nil\n\t\t}\n\t}\n\n\treturn false, schema.GroupVersionResource{}, fmt.Errorf(\"could not find resource for %s\", gvk.String())\n}\n\nfunc GetManifestsFromHydratedManifests(ctx context.Context, hydratedManifests []string) (manifest.ManifestList, error) {\n\tvar manifests manifest.ManifestList\n\tfor _, path := range hydratedManifests {\n\t\tf, err := os.Open(path)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"opening hydrated manifest at %s: %w\", path, err)\n\t\t}\n\t\tdefer f.Close()\n\t\tms, err := manifest.Load(f)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"parsing manifests file into manifest list object: %w\", err)\n\t\t}\n\t\tmanifests = append(manifests, ms...)\n\t}\n\n\treturn manifests, nil","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/deploy/util/util.go#L157-L193","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the exact Kind name with kubectl api-resources --api-group=<group> and fix any typo","Ensure the CRD is installed: kubectl get crd and apply the CRD manifest before deploying","Check the GVK's group/version is the one that actually serves the Kind","Handle case-sensitivity: Kind must match exactly (e.g. Deployment, not deployment)"],"exampleFix":"// before\nreturn false, schema.GroupVersionResource{}, fmt.Errorf(\"could not find resource for %s\", gvk.String())\n// after\nreturn false, schema.GroupVersionResource{}, fmt.Errorf(\"could not find resource for %s\", gvk.String())","handlingStrategy":"validation","validationCode":"func assertKindExists(ctx context.Context, disco discovery.DiscoveryInterface, gvk schema.GroupVersionKind) error {\n\tlist, err := disco.ServerResourcesForGroupVersion(gvk.GroupVersion().String())\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, r := range list.APIResources {\n\t\tif r.Kind == gvk.Kind {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn fmt.Errorf(\"kind %q not served by %s — apply CRDs first\", gvk.Kind, gvk.GroupVersion())\n}","typeGuard":null,"tryCatchPattern":"ok, gvr, err := GroupVersionResource(disco, gvk)\nif err != nil {\n\tif strings.Contains(err.Error(), \"could not find resource for\") {\n\t\treturn fmt.Errorf(\"kind %s not found — is the CRD installed on this cluster?\", gvk.Kind)\n\t}\n\treturn err\n}","preventionTips":["Apply CRDs before deploying resources that use them","Verify exact Kind names (case-sensitive) against kubectl api-resources output","Pin the correct apiVersion matching where the Kind is served","Include a preflight CRD check step in CI before deploy"],"tags":["kubernetes","discovery","crd","gvk"],"backgroundTag":"resource-kind-not-found","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}