{"record":{"id":"3ee340b5afe864ca","repo":"t8y2/dbx","slug":"name-must-be-positive-3ee340","errorCode":null,"errorMessage":"{name} must be positive","messagePattern":"(.+?) must be positive","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agents/drivers/iotdb/bench/run.py","lineNumber":234,"sourceCode":"\n\ndef ensure_artifacts() -> None:\n    for path in (JDBC_JAR, GO_BINARY):\n        if not path.is_file():\n            raise FileNotFoundError(path)\n\n\ndef benchmark_order(commands: dict[str, list[str]]) -> list[str]:\n    names = [name.strip() for name in os.getenv(\"BENCH_ORDER\", \"jdbc,go\").split(\",\") if name.strip()]\n    if len(names) != len(commands) or set(names) != set(commands):\n        raise ValueError(f\"BENCH_ORDER must contain exactly: {','.join(commands)}\")\n    return names\n\n\ndef env_int(name: str, fallback: int) -> int:\n    value = int(os.getenv(name, str(fallback)))\n    if value <= 0:\n        raise ValueError(f\"{name} must be positive\")\n    return value\n\n\ndef env_float(name: str, fallback: float) -> float:\n    value = float(os.getenv(name, str(fallback)))\n    if value <= 0:\n        raise ValueError(f\"{name} must be positive\")\n    return value\n\n\ndef env_bool(name: str, fallback: bool) -> bool:\n    raw = os.getenv(name)\n    if raw is None or raw == \"\":\n        return fallback\n    return raw.strip().lower() in {\"1\", \"true\", \"yes\", \"on\"}\n\n\nif __name__ == \"__main__\":","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/iotdb/bench/run.py#L216-L252","documentation":"env_int reads an integer environment variable and requires it to be strictly positive. If the parsed value is zero or negative it raises ValueError '<name> must be positive'. This guards numeric tuning knobs (iterations, sizes, timeouts) against meaningless or harmful values.","triggerScenarios":"Setting an env var consumed via env_int (called from main) to 0, a negative number, or a value that would default to <= 0 — e.g. SAMPLES=0 or THREADS=-2.","commonSituations":"Copy-pasting example configs with placeholder zeros; shell quoting mistakes turning values weird; someone 'disabling' a feature by setting its count to 0.","solutions":["Set the variable to a positive integer, e.g. SAMPLES=10.","Unset the variable to use the built-in fallback value.","Check the script for which env vars go through env_int and their defaults.","Fix CI/Makefile exports that pass 0 or negative values."],"exampleFix":"# before\nSAMPLES=0 python run.py\n# after\nSAMPLES=10 python run.py","handlingStrategy":"validation","validationCode":"import os\nraw = os.getenv(\"SAMPLES\", \"\")\nif raw and int(raw) <= 0:\n    raise SystemExit(\"SAMPLES must be a positive integer\")","typeGuard":null,"tryCatchPattern":"try:\n    value = env_int(\"SAMPLES\", 10)\nexcept ValueError as e:\n    print(f\"bad env var: {e}; using default\")\n    value = 10","preventionTips":["Never set tuning env vars to 0 or negatives","Unset variables to use safe defaults","Validate env values at pipeline start","Document allowed ranges next to each variable"],"tags":["python","env-var","validation"],"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"}