tsenart/vegeta · error
invalid report type: %s
Error message
invalid report type: %s
What it means
Returned by the `vegeta report` command when the -type flag value is shorter than 4 characters, i.e. not one of the recognized report types (text, json, histogram, plot). It's an early sanity check on the report type string.
Source
Thrown at report.go:63
buckets := fs.String("buckets", "", "Histogram buckets, e.g.: \"[0,1ms,10ms]\"")
fs.Usage = func() {
fmt.Fprintf(os.Stderr, "%s\n", reportUsage)
}
return command{fs, func(args []string) error {
fs.Parse(args)
files := fs.Args()
if len(files) == 0 {
files = append(files, "stdin")
}
return report(files, *typ, *output, *every, *buckets)
}}
}
func report(files []string, typ, output string, every time.Duration, bucketsStr string) error {
if len(typ) < 4 {
return fmt.Errorf("invalid report type: %s", typ)
}
dec, mc, err := decoder(files)
defer mc.Close()
if err != nil {
return err
}
out, err := file(output, true)
if err != nil {
return err
}
defer out.Close()
var (
rep vegeta.Reporter
report vegeta.Report
)View on GitHub (pinned to cf58112690)
Solutions
- Pass a valid type: text, json, histogram (or plot via the dedicated `vegeta plot` command).
- Quote and verify the -type value in shell scripts to avoid empty expansion.
- Run `vegeta report -h` to list supported types for your installed version.
- Update scripts after vegeta upgrades; type names changed across versions (plot was removed from report).
Example fix
// before vegeta report -type=j results.bin // after vegeta report -type=json results.bin
Defensive patterns
Strategy: validation
Validate before calling
var validTypes = map[string]bool{"text": true, "json": true, "histogram": true}
func validateReportType(t string) error {
if !validTypes[t] {
return fmt.Errorf("-type must be one of text|json|histogram, got %q", t)
}
return nil
} Try / catch
if err := runReport(args); err != nil {
if strings.HasPrefix(err.Error(), "invalid report type") {
return fmt.Errorf("check -type flag: %w", err)
}
return err
} Prevention
- Validate the -type flag against known values before invoking.
- Quote flag variables in shell to catch empty expansions.
- Pin vegeta version and check `vegeta report -h` after upgrades.
When it happens
Trigger: Running `vegeta report -type=xyz ...` (or a typo/empty value with length < 4), e.g. "j", "htm", "".
Common situations: Typos in the -type flag, shell variable defaults expanding to empty, older scripts using removed type names.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- -rate=0 requires setting -max-workers
- format %q isn't one of [%s]
- encode: unknown encoding %q
- The plot reporter has been deprecated and succeeded by the v
- rate frequency and time unit must be bigger than zero
AI-assisted analysis of tsenart/vegeta@cf58112690 (2026-08-31).
Data as JSON: /api/errors/ec8d9bfcadc2c38d.
Report an issue: GitHub.