kubernetes/kops · error

Invalid value for %v: %v

Error message

Invalid value for %v: %v

What it means

Thrown by includeBootVolumeOptions when the metadata key openstack.BOOT_VOLUME_SIZE (kops.openstack.org/boot-volume-size) cannot be parsed by strconv.ParseInt(s, 10, 64). This is a pure client-side validation error before any Nova call — the metadata value must be a base-10 integer representing the boot volume size in GB. The wrapped strconv.NumError is included in the message.

Source

Thrown at upup/pkg/fi/cloudup/openstacktasks/instance.go:447

	i, err := t.Cloud.GetImage(fi.ValueOf(e.Image))
	if err != nil {
		return servers.CreateOpts{}, fmt.Errorf("Error getting image information: %v", err)
	}

	blockDevice := servers.BlockDevice{
		BootIndex:           0,
		DeleteOnTermination: true,
		DestinationType:     "volume",
		SourceType:          "image",
		UUID:                i.ID,
		VolumeSize:          i.MinDiskGigabytes,
	}

	if s, ok := e.Metadata[openstack.BOOT_VOLUME_SIZE]; ok {
		i, err := strconv.ParseInt(s, 10, 64)
		if err != nil {
			return servers.CreateOpts{}, fmt.Errorf("Invalid value for %v: %v", openstack.BOOT_VOLUME_SIZE, err)
		}

		blockDevice.VolumeSize = int(i)
	}

	opts.BlockDevice = []servers.BlockDevice{blockDevice}
	return opts, nil
}

func bootFromVolume(m map[string]string) bool {
	v, ok := m[openstack.BOOT_FROM_VOLUME]
	if !ok {
		return false
	}

	switch v {
	case "true", "enabled":
		return true

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set BOOT_VOLUME_SIZE metadata to a plain base-10 integer of gigabytes, e.g. "50" instead of "50GB"
  2. Verify what was actually set: inspect the instance task metadata in the cluster spec / `kops toolbox template` output and fix the value
  3. If a unit is desired, convert manually (50GB → 50) — the code does no unit parsing
  4. Rerun `kops update cluster` after correcting; also fix any automation (scripts/Helm values) generating the metadata

Example fix

// before (cluster spec metadata)
kops.k8s.io/boot-volume-size: "100GB"
// after
kops.k8s.io/boot-volume-size: "100"
Defensive patterns

Strategy: validation

Validate before calling

// validate BOOT_VOLUME_SIZE metadata is a plain base-10 integer before apply
func validateBootVolumeSize(metadata map[string]string) error {
	s, ok := metadata[openstack.BOOT_VOLUME_SIZE]
	if !ok {
		return nil
	}
	if _, err := strconv.ParseInt(s, 10, 64); err != nil {
		return fmt.Errorf("%s must be a plain integer of GB, got %q: %w", openstack.BOOT_VOLUME_SIZE, s, err)
	}
	return nil
}

Type guard

func isBootVolumeSizeValid(metadata map[string]string) bool {
	s, ok := metadata[openstack.BOOT_VOLUME_SIZE]
	if !ok {
		return true
	}
	_, err := strconv.ParseInt(s, 10, 64)
	return err == nil
}

Prevention

When it happens

Trigger: Instance metadata contains a non-numeric boot-volume-size value, e.g. "50GB", "50Gi", "0x32", "50.0", or an empty string; set via cluster spec openstack metadata or blockStore config. Parse fails with `strconv.ParseInt: parsing "...": invalid syntax` (or value out of range for int64).

Common situations: User wrote "50GB" or "50 GiB" instead of plain "50"; value copied from Terraform-style config that allows units; shell interpolation produced an empty string; decimal size like "12.5"; value set programmatically as a formatted number with thousands separator.

Related errors


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