{"record":{"id":"3b3e9a736ed3259e","repo":"t8y2/dbx","slug":"name-must-be-positive-3b3e9a","errorCode":null,"errorMessage":"{name} must be positive","messagePattern":"(.+?) must be positive","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agents/drivers/cassandra-go/bench/agent_compare.py","lineNumber":304,"sourceCode":"\ndef required_path(name: str) -> Path:\n    value = os.getenv(name, \"\")\n    if not value:\n        raise ValueError(f\"{name} is required\")\n    path = Path(value).expanduser().resolve()\n    if not path.is_file():\n        raise FileNotFoundError(path)\n    return path\n\n\ndef env_default(name: str, fallback: str) -> str:\n    return os.getenv(name, \"\") or fallback\n\n\ndef env_int(name: str, fallback: int) -> int:\n    value = int(env_default(name, str(fallback)))\n    if value < 1:\n        raise ValueError(f\"{name} must be positive\")\n    return value\n\n\ndef env_float(name: str, fallback: float) -> float:\n    value = float(env_default(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    normalized = raw.strip().lower()\n    if normalized in {\"1\", \"true\", \"yes\", \"on\"}:\n        return True\n    if normalized in {\"0\", \"false\", \"no\", \"off\"}:","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/cassandra-go/bench/agent_compare.py#L286-L322","documentation":"env_int reads an environment variable as an integer and raises ValueError('{name} must be positive') when the value is less than 1. Counts, sizes, and iterations for the benchmark must be >= 1, so zero/negative values are rejected.","triggerScenarios":"Calling env_int (from main, connection_params, or configured_workloads) with an env var set to '0', '-3', or another integer below 1.","commonSituations":"Setting a count to 0 intending 'unlimited' or 'skip'; arithmetic in a wrapper script producing a negative; typo in a CI matrix value.","solutions":["Set the variable to a positive integer, e.g. export BENCH_ITERATIONS=100","Audit `env | grep -i BENCH` for 0/negative values before running","Fix the generating script so the computed value is always >= 1"],"exampleFix":"// before\nBENCH_ITERATIONS=0 python agent_compare.py\n// after\nBENCH_ITERATIONS=10 python agent_compare.py","handlingStrategy":"validation","validationCode":"def validate_positive_int(name: str) -> int:\n    raw = os.getenv(name)\n    if raw is None or raw == \"\":\n        raise SystemExit(f\"{name} must be set to a positive integer\")\n    try:\n        value = int(raw)\n    except ValueError:\n        raise SystemExit(f\"{name}={raw!r} is not an integer\")\n    if value < 1:\n        raise SystemExit(f\"{name}={raw!r} must be >= 1\")\n    return value\n\nvalidate_positive_int(\"BENCH_ITERATIONS\")","typeGuard":"def is_positive_int(raw: str | None) -> bool:\n    if raw is None or raw == \"\":\n        return False\n    try:\n        return int(raw) >= 1\n    except ValueError:\n        return False","tryCatchPattern":null,"preventionTips":["Use >= 1 defaults in CI matrices; never use 0 as 'run everything'","Print effective numeric settings at bench startup","Clamp computed values: max(1, computed) before export","Add a preflight env-var lint step shared across bench scripts"],"tags":["python","environment","configuration","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"}