{"record":{"id":"831b516a73a5f9a0","repo":"kubernetes/kops","slug":"unexpected-resource-type-s","errorCode":null,"errorMessage":"unexpected resource type: %s","messagePattern":"unexpected resource type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/spotinst/resources.go","lineNumber":272,"sourceCode":"\t}\n\n\tswitch ResourceType(resource.Type) {\n\tcase ResourceTypeInstanceGroup:\n\t\t{\n\t\t\tif group, ok := resource.Obj.(InstanceGroup); ok {\n\t\t\t\treturn buildCloudInstanceGroupFromInstanceGroup(cloud, ig, group, nodeMap)\n\t\t\t}\n\t\t}\n\n\tcase ResourceTypeLaunchSpec:\n\t\t{\n\t\t\tif spec, ok := resource.Obj.(LaunchSpec); ok {\n\t\t\t\treturn buildCloudInstanceGroupFromLaunchSpec(cloud, ig, spec, nodeMap)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"unexpected resource type: %s\", resource.Type)\n}\n\nfunc buildCloudInstanceGroupFromInstanceGroup(cloud Cloud, ig *kops.InstanceGroup, group InstanceGroup,\n\tnodeMap map[string]*v1.Node) (*cloudinstances.CloudInstanceGroup, error,\n) {\n\tinstanceGroup := &cloudinstances.CloudInstanceGroup{\n\t\tHumanName:     group.Name(),\n\t\tInstanceGroup: ig,\n\t\tMinSize:       group.MinSize(),\n\t\tTargetSize:    group.MinSize(), // TODO: Retrieve the target size from the cloud provider\n\t\tMaxSize:       group.MaxSize(),\n\t\tRaw:           group,\n\t}\n\n\tvar svc InstanceGroupService\n\tswitch group.Type() {\n\tcase InstanceGroupElastigroup:\n\t\tsvc = cloud.Elastigroup()","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/spotinst/resources.go#L254-L290","documentation":"A fall-through switch guard: buildCloudInstanceGroupFromResource receives a resource whose Type is neither ResourceTypeInstanceGroup nor ResourceTypeLaunchSpec (or whose Obj fails the type assertion), so it cannot build a cloud instance group for it.","triggerScenarios":"Thrown at pkg/resources/spotinst/resources.go:272 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check how the resource tracker was created — only instance group and launch spec types are supported","Report a kOps bug if a new spotinst resource type was added without updating this switch","Re-run discovery after fixing the resource type"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}