tailscale/tailscale · error

empty size

Error message

empty size

What it means

parseSizeBytes converts the --disk-size flag (forms like '4G', '8192M', '1024K', or plain bytes) into a byte count. After strings.TrimSpace, an empty string means no size was supplied, which the parser rejects because the disk image needs a concrete size; the error is returned wrapped by the caller as 'parsing --disk-size: empty size'.

Source

Thrown at cmd/tailscale/cli/configure-pve-appliance.go:384

	)
}

// runQM invokes `qm` with args, streaming its output to Stderr so the
// caller can see disk-import progress and any error messages.
func runQM(ctx context.Context, args ...string) error {
	printf("$ qm %s\n", strings.Join(args, " "))
	cmd := exec.CommandContext(ctx, "qm", args...)
	cmd.Stdout = Stderr
	cmd.Stderr = Stderr
	return cmd.Run()
}

// parseSizeBytes parses a size string like "4G", "8192M", "1024K", or
// "12345" (bytes) into a byte count. Empty string returns an error.
func parseSizeBytes(s string) (int64, error) {
	s = strings.TrimSpace(s)
	if s == "" {
		return 0, errors.New("empty size")
	}
	mult := int64(1)
	switch last := s[len(s)-1]; {
	case last >= '0' && last <= '9':
		// no suffix
	default:
		switch last {
		case 'K', 'k':
			mult = 1 << 10
		case 'M', 'm':
			mult = 1 << 20
		case 'G', 'g':
			mult = 1 << 30
		case 'T', 't':
			mult = 1 << 40
		default:
			return 0, fmt.Errorf("unknown size suffix %q", string(last))
		}

View on GitHub (pinned to cfe32b8be6)

Solutions

  1. Supply a concrete size: `--disk-size=8G` (also accepts M/K or raw bytes)
  2. In scripts, default it first: `--disk-size="${DISK_SIZE:-8G}"` or fail fast with `:?` expansion
  3. Validate the value before invoking: it must be digits optionally followed by K/M/G

Example fix

# before
$ sudo tailscale configure pve-appliance --storage=local-lvm --disk-size=
error: parsing --disk-size: empty size

# after
$ sudo tailscale configure pve-appliance --storage=local-lvm --disk-size=8G
Defensive patterns

Strategy: validation

Validate before calling

DISK_SIZE="${DISK_SIZE:-8G}"
case "$DISK_SIZE" in
  ''|*[!0-9KkMmGg]*) echo "bad --disk-size: '$DISK_SIZE'"; exit 2 ;;
esac
tailscale configure pve-appliance --storage=local-lvm --disk-size="$DISK_SIZE"

Try / catch

n, err := parseSizeBytes(sizeStr)
if err != nil {
    return fmt.Errorf("--disk-size=%q invalid (want 4G/512M/bytes): %w", sizeStr, err)
}

Prevention

When it happens

Trigger: Passing --disk-size= or --disk-size=' ' (whitespace only), or an unset variable expanding to an empty string, so parseSizeBytes gets "" at configure-pve-appliance.go:384.

Common situations: Shell scripts where $DISK_SIZE is unset/empty but the flag is still emitted; YAML/CI templates with an optional size field left blank; env var name typo producing an empty expansion.

Related errors


AI-assisted analysis of tailscale/tailscale@cfe32b8be6 (2026-08-15). Data as JSON: /api/errors/e39a42924f7dffc3. Report an issue: GitHub.