VectleSkillsError: cannot parse 'disk_size' as uint (Packer)

Error: cannot parse 'disk_size' as uint (Packer)

Export

Fixes packer validate failing to parse disk_size values with unit suffixes. For engineers whose templates use human-readable sizes like '5G', the fix is plain megabytes.

Error: cannot parse 'disk_size' as uint: strconv.ParseUint: parsing "5G": invalid syntax (Packer)

TL;DR

disk_size takes a bare number in MiB, not a human-readable size. Change "5G" to "5120".

The error

Build 'ubuntu-aarch64' prepare failure: 1 error(s) decoding:

* cannot parse 'disk_size' as uint: strconv.ParseUint: parsing "5G": invalid syntax

Fix it

  1. Find the disk_size (or your build_disk_size variable) in the template.
  • Success check: you see the quoted "5G" or similar suffix.
  1. Replace with mebibytes as a bare number: 5 GiB becomes 5120, 20 GiB becomes 20480.
  • Success check: the value is digits only (quotes are fine; the suffix is the problem).
  1. Run packer validate.
  • Success check: the decoding error is gone.
  1. Re-run packer build.
  • Success check: the build prepares and proceeds.

When to use this

You hit this at prepare/validate time with a disk_size carrying a unit suffix.

When NOT to use this

Do not use this for disk space errors during provisioning (guest ran out of room; increase the size) or for cloud block-device size limits.

Compatibility

Packer 1.x, qemu and other builders with numeric disk_size.

Variants

  • cannot parse '[other-field]' as uint for any numeric field given a suffixed string
  • "5GB", "5120M", "20g" all fail the same way

Root cause

The field decodes as an unsigned int in MiB. Go's ParseUint rejects anything but digits, so unit suffixes fail at config decode time, before the build starts.

Edge cases

  • Some builders document the unit as MiB explicitly; others just say "size". When in doubt, assume MiB.
  • Template variables pass the string through; fix the variable default or the -var value, not just the template.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=Error%3A+cannot+parse+%27disk_size%27+as+uint+%28Packer%29&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.