{"record":{"id":"00014fec1a9d0ae5","repo":"t8y2/dbx","slug":"s-must-be-a-positive-integer","errorCode":null,"errorMessage":"%s must be a positive integer","messagePattern":"(.+?) must be a positive integer","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/iotdb/bench/go/main.go","lineNumber":268,"sourceCode":"func elapsedMS(started time.Time) float64 {\n\treturn float64(time.Since(started).Microseconds()) / 1_000\n}\n\nfunc roundMillis(value float64) float64 {\n\treturn float64(int64(value*1_000+0.5)) / 1_000\n}\n\nfunc env(name, fallback string) string {\n\tif value := os.Getenv(name); value != \"\" {\n\t\treturn value\n\t}\n\treturn fallback\n}\n\nfunc envInt(name string, fallback int) int {\n\tvalue, err := strconv.Atoi(env(name, strconv.Itoa(fallback)))\n\tif err != nil || value <= 0 {\n\t\tfatal(fmt.Errorf(\"%s must be a positive integer\", name))\n\t}\n\treturn value\n}\n\nfunc writeJSON(value any) {\n\tencoder := json.NewEncoder(os.Stdout)\n\tencoder.SetEscapeHTML(false)\n\tif err := encoder.Encode(value); err != nil {\n\t\tfatal(err)\n\t}\n}\n\nfunc fatal(err error) {\n\tfmt.Fprintln(os.Stderr, err)\n\tos.Exit(1)\n}\n","sourceCodeStart":250,"sourceCodeEnd":285,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/iotdb/bench/go/main.go#L250-L285","documentation":"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.","triggerScenarios":"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'.","commonSituations":"Duration-style values like '30000ms' instead of '30000'; empty variable defaulting to '' after being exported empty; copy-pasted config with a comma '1,000'.","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"],"exampleFix":"// before\nexport BENCH_HOLD_MS=30s\n// after\nexport BENCH_HOLD_MS=30000","handlingStrategy":"validation","validationCode":"func checkPositiveIntEnv(name string) error {\n  v := os.Getenv(name)\n  if v == \"\" { return nil }\n  n, err := strconv.Atoi(v)\n  if err != nil || n <= 0 {\n    return fmt.Errorf(\"%s must be a plain positive integer, got %q\", name, v)\n  }\n  return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["env-var","config","validation","iotdb"],"backgroundTag":"invalid-env-var-value","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}