kubernetes/kops · error

expected VirtualMachineScaleSetVM, got %T

Error message

expected VirtualMachineScaleSetVM, got %T

What it means

A type assertion guard: DumpVMScaleSetVM finds the resource's Obj is not a *compute.VirtualMachineScaleSetVM, so the dump cannot proceed — an internal invariant violation in resource tracker construction, not user input.

Source

Thrown at pkg/resources/azure/dump.go:87

	data := make(map[string]interface{})
	data["id"] = r.ID
	data["type"] = r.Type
	data["raw"] = r.Obj
	op.Dump.Resources = append(op.Dump.Resources, data)

	return nil
}

func DumpVMScaleSetVM(op *resources.DumpOperation, r *resources.Resource) error {
	data := make(map[string]interface{})
	data["id"] = r.ID
	data["type"] = r.Type
	data["raw"] = r.Obj
	op.Dump.Resources = append(op.Dump.Resources, data)

	vm, ok := r.Obj.(*compute.VirtualMachineScaleSetVM)
	if !ok {
		return fmt.Errorf("expected VirtualMachineScaleSetVM, got %T", r.Obj)
	}

	rid, err := arm.ParseResourceID(r.ID)
	if err != nil {
		return err
	}
	vmssName := ""
	if rid.Parent != nil {
		vmssName = rid.Parent.Name
	}

	instance := &resources.Instance{Name: r.Name}
	if instance.Name == "" {
		if vm.Properties != nil && vm.Properties.OSProfile != nil && vm.Properties.OSProfile.ComputerName != nil {
			instance.Name = *vm.Properties.OSProfile.ComputerName
		} else {
			instance.Name = rid.Name
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify the resource tracker was built by toVMScaleSetVMResource with the correct Obj type
  2. Report a kOps bug if triggered by unmodified code
  3. Re-run the dump after rebuilding resource discovery state
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at pkg/resources/azure/dump.go:87 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/e7ede262fba1baad. Report an issue: GitHub.