kubernetes/kops · error

unhandled change type: %v

Error message

unhandled change type: %v

What it means

Thrown by buildChangeList in the dry-run target when the changes object's Go type is neither a struct nor a map — the reflect-based differ only knows how to enumerate struct fields or map entries. It indicates a task used a changes type of an unexpected kind (slice, basic type, pointer-to-non-struct, etc.), so the diff report cannot be produced.

Source

Thrown at upup/pkg/fi/dryrun_target.go:399

				case Resource:
					resA, okA := tryResourceAsString(fieldValA)
					resE, okE := tryResourceAsString(fieldValE)
					if okA && okE {
						description = diff.FormatDiff(resA, resE)
					}
				}

				if !ignored && description == "" {
					description = fmt.Sprintf(" %v -> %v", reflectutils.ValueAsString(fieldValA), reflectutils.ValueAsString(fieldValE))
				}
			}
			if ignored {
				continue
			}
			changeList = append(changeList, change{FieldName: valC.Type().Field(i).Name, Description: description})
		}
	} else {
		return nil, fmt.Errorf("unhandled change type: %v", valC.Type())
	}

	return changeList, nil
}

func tryResourceAsString(v reflect.Value) (string, bool) {
	if !v.IsValid() {
		return "", false
	}
	if !v.CanInterface() {
		return "", false
	}

	// Guard against nil interface go-tcha
	if v.Kind() == reflect.Interface && v.IsNil() {
		return "", false
	}
	if v.Kind() == reflect.Ptr && v.IsNil() {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Make the task's changes type a struct (fields are diffed individually) or a map[string]...
  2. Avoid slices or scalar types as the changes object; wrap them in a struct field
  3. Add a case for the new kind in buildChangeList if extending the differ
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/dryrun_target.go:399 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/6fbdd53e625ce301. Report an issue: GitHub.