portainer/portainer · error
unable to determine resource type
Error message
unable to determine resource type
What it means
Error "unable to determine resource type" thrown in portainer/portainer.
Source
Thrown at pkg/libkubectl/apply_dynamic.go:173
// When dryRun is set the request is sent with dry-run=All, so the API server validates it without persisting it.
func (c *Client) applyResource(ctx context.Context, setup *applySetup, resourceYAML []byte, dryRun bool) (appliedResource, error) {
var applied appliedResource
obj := &unstructured.Unstructured{}
decoder := yaml.NewYAMLOrJSONDecoder(strings.NewReader(string(resourceYAML)), 4096)
if err := decoder.Decode(obj); err != nil {
return applied, fmt.Errorf("failed to decode YAML: %w", err)
}
// Skip empty objects
if obj.Object == nil {
return applied, nil
}
// Get GVK (GroupVersionKind) from the object
gvk := obj.GroupVersionKind()
if gvk.Empty() {
return applied, errors.New("unable to determine resource type")
}
applied.Kind = gvk.Kind
applied.Name = obj.GetName()
// Map GVK to GVR (GroupVersionResource)
mapping, err := setup.mapper.RESTMapping(gvk.GroupKind(), gvk.Version)
if err != nil {
return applied, fmt.Errorf("failed to map resource type %s: %w", gvk.String(), err)
}
// Get the dynamic resource client
var resourceClient dynamic.ResourceInterface
if mapping.Scope.Name() == meta.RESTScopeNameNamespace {
namespace, err := resolveNamespace(setup.configuredNamespace, obj.GetNamespace())
if err != nil {
return applied, fmt.Errorf("namespace conflict for %s %q: %w", gvk.Kind, applied.Name, err)View on GitHub (pinned to 17e74456ff)
When it happens
Trigger: Thrown at pkg/libkubectl/apply_dynamic.go:173 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of portainer/portainer@17e74456ff (2026-08-26).
Data as JSON: /api/errors/f327fa3653f3e47b.
Report an issue: GitHub.