tsenart/vegeta · error

-max-body=%d overflows int64

Error message

-max-body=%d overflows int64

What it means

The -max-body flag parses its value with a datasize.ByteSize (text form like 10MB). If the parsed size exceeds math.MaxInt64, it cannot be stored in the flag's int64 target, so Set returns this overflow error before assigning.

Source

Thrown at flags.go:121

	}
	return fmt.Sprintf("%d/%s", f.Freq, f.Per)
}

type maxBodyFlag struct{ n *int64 }

func (f *maxBodyFlag) Set(v string) (err error) {
	if v == "-1" {
		*(f.n) = -1
		return nil
	}

	var ds datasize.ByteSize
	if err = ds.UnmarshalText([]byte(v)); err != nil {
		return err
	}

	if ds > math.MaxInt64 {
		return fmt.Errorf("-max-body=%d overflows int64", ds)
	}

	*(f.n) = int64(ds)
	return nil
}

func (f *maxBodyFlag) String() string {
	if f.n == nil {
		return ""
	} else if *(f.n) == -1 {
		return "-1"
	}
	return datasize.ByteSize(*(f.n)).String()
}

type dnsTTLFlag struct{ ttl *time.Duration }

func (f *dnsTTLFlag) Set(v string) (err error) {

View on GitHub (pinned to cf58112690)

Solutions

  1. Lower the -max-body value so it fits in int64 (< 9223372036854775807 bytes, i.e. < 8EB).
  2. Use a sane size like -max-body=10MB.
  3. Validate the configured size before passing it to vegeta.
  4. Check for duplicated or concatenated suffixes (e.g. 10MBMB) that inflate the parsed value.

Example fix

// before
vegeta attack -max-body=9223372036854775808B ...
// after
vegeta attack -max-body=10MB ...
Defensive patterns

Strategy: validation

Validate before calling

const maxInt64 uint64 = math.MaxInt64
func fitsInt64(s string) bool {
	var ds datasize.ByteSize
	if err := ds.UnmarshalText([]byte(s)); err != nil {
		return false
	}
	return uint64(ds) <= maxInt64
}

Prevention

When it happens

Trigger: Calling MaxBody.Set (or -max-body) with a datasize whose byte value exceeds math.MaxInt64, e.g. 9223372036854775808B or exabyte-range values.

Common situations: Typo in the size suffix or unit causing an enormous multiplier (e.g. 10EB); generated configs with unsanitized sizes; misunderstanding that the value is bytes capped at int64.

Related errors


AI-assisted analysis of tsenart/vegeta@cf58112690 (2026-08-31). Data as JSON: /api/errors/7e3a727e301b0107. Report an issue: GitHub.