{"record":{"id":"621426f0fb1f8dc8","repo":"GoogleContainerTools/skaffold","slug":"could-not-fetch-custom-resources-w","errorCode":null,"errorMessage":"could not fetch custom resources: %w","messagePattern":"could not fetch custom resources: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/kubernetes/status/status_check.go","lineNumber":328,"sourceCode":"\tfor _, r := range uRes {\n\t\tresName := r.GroupVersionKind().String()\n\t\tif r.GetName() != \"\" {\n\t\t\tresName = fmt.Sprintf(\"%s, Name=%s\", resName, r.GetName())\n\t\t}\n\t\tpd := diag.New([]string{ns}).\n\t\t\tWithLabel(label.RunIDLabel, l.Labels()[label.RunIDLabel]).\n\t\t\tWithValidators([]validator.Validator{validator.NewConfigConnectorValidator(client, dynClient, r.GroupVersionKind())})\n\t\tresult = append(result, resource.NewResource(resName, resource.ResourceTypes.ConfigConnector, ns, deadlineDuration, tolerateFailures).WithValidator(pd))\n\t}\n\n\treturn result, nil\n}\n\nfunc getCustomResources(client kubernetes.Interface, dynClient dynamic.Interface, m manifest.ManifestList, ns string, deadlineDuration time.Duration, tolerateFailures bool, selector manifest.GroupKindSelector) ([]*resource.Resource, error) {\n\tvar result []*resource.Resource\n\tuRes, err := m.SelectResources(selector)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not fetch custom resources: %w\", err)\n\t}\n\tfor _, r := range uRes {\n\t\tresName := r.GroupVersionKind().String()\n\t\tif r.GetName() != \"\" {\n\t\t\tresName = fmt.Sprintf(\"%s, Name=%s\", resName, r.GetName())\n\t\t}\n\t\tpd := diag.New([]string{ns}).\n\t\t\tWithValidators([]validator.Validator{validator.NewCustomValidator(client, dynClient, r.GroupVersionKind())})\n\t\tresult = append(result, resource.NewResource(resName, resource.ResourceTypes.CustomResource, ns, deadlineDuration, tolerateFailures).WithValidator(pd))\n\t}\n\n\treturn result, nil\n}\n\nfunc getDeployments(ctx context.Context, client kubernetes.Interface, ns string, l *label.DefaultLabeller, deadlineDuration time.Duration, tolerateFailures bool) ([]*resource.Resource, error) {\n\tdeps, err := client.AppsV1().Deployments(ns).List(ctx, metav1.ListOptions{\n\t\tLabelSelector: l.RunIDSelector(),\n\t})","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/kubernetes/status/status_check.go#L310-L346","documentation":"getCustomResources wraps errors from m.SelectResources(selector) — selecting user-configured custom resources from the manifest list — with this message. It is a local manifest-processing failure surfaced as STATUSCHECK_CUSTOM_RESOURCE_FETCH_ERR.","triggerScenarios":"manifest.ManifestList.SelectResources(manifest.GroupKindSelector) errors: unparseable manifest documents or an invalid/failed selection against the configured group/kind.","commonSituations":"statusCheck custom-resource selector misconfigured (wrong group/kind casing); manifests with YAML syntax problems; CRD kind renamed so selection logic trips; pipeline rendering emitting invalid YAML (e.g. from helm/kustomize output).","solutions":["Check the GroupKindSelector spelling in skaffold.yaml against 'kubectl api-resources'","Validate all rendered manifests parse (skaffold render + dry-run client apply)","Regenerate manifests from helm/kustomize to fix broken rendering output","Bisect manifests to find the failing resource","Fix YAML issues, then re-run deploy/status check"],"exampleFix":"// before: kind casing wrong in selector\n//   { group: example.com, kind: myresource }\n// after:\n//   { group: example.com, kind: MyResource }","handlingStrategy":"validation","validationCode":"for (const sel of crSelectors) {\n  if (!sel.GroupKind || !sel.GroupKind.group || !sel.GroupKind.kind) {\n    throw new Error('invalid GroupKindSelector: group and kind are required');\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await statusCheck();\n} catch (err) {\n  if (err.message.includes('could not fetch custom resources')) {\n    // selector config or manifest issue — validate config and lint manifests\n  }\n  throw err;\n}","preventionTips":["Validate GroupKindSelector fields (group, kind) before running","Match kind casing exactly to the CRD (e.g. MyResource)","Re-generate helm/kustomize output when manifests fail to parse","Keep CRD versions and selectors in sync"],"tags":["kubernetes","custom-resources","manifest","yaml"],"backgroundTag":"manifest-selection-failed","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"}