derailed/k9s · error
the server doesn't have a resource type '%s'
Error message
the server doesn't have a resource type '%s'
What it means
RestMapper.ResourceFor resolves a user-supplied resource argument through the discovery-backed mapper. When the argument carries no group and resolution fails, the underlying meta.NoResourceMatchError is rewritten into this kubectl-style message naming the bare resource.
Source
Thrown at internal/dao/rest_mapper.go:69
var (
gvr schema.GroupVersionResource
err error
)
mapper, err := r.ToRESTMapper()
if err != nil {
return gvr, err
}
fullGVR, gr := schema.ParseResourceArg(strings.ToLower(resourceArg))
if fullGVR != nil {
return mapper.ResourceFor(*fullGVR)
}
gvr, err = mapper.ResourceFor(gr.WithVersion(""))
if err != nil {
if gr.Group == "" {
return gvr, fmt.Errorf("the server doesn't have a resource type '%s'", gr.Resource)
}
return gvr, fmt.Errorf("the server doesn't have a resource type '%s' in group '%s'", gr.Resource, gr.Group)
}
return gvr, nil
}
func (*RestMapper) toRESTMapping(gvr schema.GroupVersionResource, kind string) *meta.RESTMapping {
return &meta.RESTMapping{
Resource: gvr,
GroupVersionKind: schema.GroupVersionKind{
Group: gvr.Group,
Version: gvr.Version,
Kind: kind,
},
Scope: RestMapping,
}
}View on GitHub (pinned to 2d3ccc6ba2)
Solutions
- List what the cluster actually serves: kubectl api-resources and fix the spelling
- Install the CRD/operator that provides the resource, then retry
- Prefer group-qualified names (apps/deployments) so failures point at the exact group (see the sibling group error)
Example fix
# before resource: deploymentss # after resource: deployments # verify with: kubectl api-resources | grep deploy
Defensive patterns
Strategy: validation
Validate before calling
names, err := f.Client().Discovery().ServerResourceNames() // or cached mapper
if err != nil { return err }
if !containsResource(names, resourceArg) {
return fmt.Errorf("resource %q not served by this cluster", resourceArg)
} Try / catch
if _, err := mapper.ResourceFor(gvr); err != nil {
if strings.Contains(err.Error(), "doesn't have a resource type") {
// suggest closest match from kubectl api-resources instead of retrying
}
} Prevention
- Resolve resource names against live discovery at startup and fail with suggestions
- Pin configs to group-qualified resource names rather than bare plurals
- After installing CRDs, refresh discovery caches before resolving new types
When it happens
Trigger: Resolving a group-less GVR string such as "pds" or "ingres" when the cluster exposes no resource with that name — typos, absent CRDs, wrong pluralization.
Common situations: Typos in resource names on the command line or in config; CRDs not yet installed on the target cluster (cert-manager, gateway-api, operators); kubeconfig pointing at a cluster that lacks the aggregated API.
Related errors
- the server doesn't have a resource type '%s' in group '%s'
- strings.Join(errs, " - ")
- failed to decode table rows: %w
- expecting a scalable resource for %q
- ACCESS -- No API server connection
AI-assisted analysis of derailed/k9s@2d3ccc6ba2 (2026-08-15).
Data as JSON: /api/errors/44699cfd0e1af5c2.
Report an issue: GitHub.