t8y2/dbx · error
%s must be a positive integer
Error message
%s must be a positive integer
What it means
envInt parses an environment variable as an integer and rejects any value that is not parseable or not strictly positive, exiting via fatal with '%s must be a positive integer'. Bench configuration variables must all be positive ints.
Source
Thrown at agents/drivers/iotdb/bench/go/main.go:268
func elapsedMS(started time.Time) float64 {
return float64(time.Since(started).Microseconds()) / 1_000
}
func roundMillis(value float64) float64 {
return float64(int64(value*1_000+0.5)) / 1_000
}
func env(name, fallback string) string {
if value := os.Getenv(name); value != "" {
return value
}
return fallback
}
func envInt(name string, fallback int) int {
value, err := strconv.Atoi(env(name, strconv.Itoa(fallback)))
if err != nil || value <= 0 {
fatal(fmt.Errorf("%s must be a positive integer", name))
}
return value
}
func writeJSON(value any) {
encoder := json.NewEncoder(os.Stdout)
encoder.SetEscapeHTML(false)
if err := encoder.Encode(value); err != nil {
fatal(err)
}
}
func fatal(err error) {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
View on GitHub (pinned to c0390bff16)
Solutions
- Set the variable to a plain positive integer (e.g. 100)
- Remove unit suffixes and separators ('30000' not '30s', '1,000')
- Check loadConfig/main.go for the exact variable names expected
- Unset an empty-valued variable so the built-in fallback applies
Example fix
// before export BENCH_HOLD_MS=30s // after export BENCH_HOLD_MS=30000
Defensive patterns
Strategy: validation
Validate before calling
func checkPositiveIntEnv(name string) error {
v := os.Getenv(name)
if v == "" { return nil }
n, err := strconv.Atoi(v)
if err != nil || n <= 0 {
return fmt.Errorf("%s must be a plain positive integer, got %q", name, v)
}
return nil
} Prevention
- Never attach unit suffixes or thousands separators to int env vars
- Validate all bench env vars in a shell preflight before launching
- Prefer unset over empty-string export so fallbacks apply
When it happens
Trigger: Setting any bench int env var (e.g. IOTDB_BENCH_ITERATIONS, BENCH_HOLD_MS, workload iterations) to 0, a negative number, or non-numeric text like '10s' or 'ten'.
Common situations: Duration-style values like '30000ms' instead of '30000'; empty variable defaulting to '' after being exported empty; copy-pasted config with a comma '1,000'.
Understand the failure class
Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.
Related errors
- unsupported IOTDB_BENCH_MODE: %s
- unsupported IoTDB connection scheme: %s
- invalid IoTDB port: %s
- ${name} must be a positive integer
- BENCH_ORDER must contain exactly: {','.join(commands)}
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/00014fec1a9d0ae5.
Report an issue: GitHub.