{"record":{"id":"2d2cf4501ce192f0","repo":"t8y2/dbx","slug":"path","errorCode":null,"errorMessage":"{path}","messagePattern":"\\{path\\}","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"agents/drivers/argo-go/bench/agent_compare.py","lineNumber":621,"sourceCode":"\ndef percentile(values: list[float], fraction: float) -> float:\n    if not values:\n        return 0.0\n    index = min(len(values) - 1, max(0, round((len(values) - 1) * fraction)))\n    return values[index]\n\n\ndef elapsed_ms(started: float) -> float:\n    return (time.perf_counter() - started) * 1000\n\n\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_int_list(name: str, fallback: list[int]) -> list[int]:\n    raw = os.getenv(name, \"\")\n    values = fallback if not raw else [int(value.strip()) for value in raw.split(\",\")]\n    if not values or any(value < 1 for value in values):","sourceCodeStart":603,"sourceCodeEnd":639,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/argo-go/bench/agent_compare.py#L603-L639","documentation":"required_path raises FileNotFoundError(path) when the variable is set but the resolved path is not an existing regular file. The bare path is used as the exception message. This catches stale or wrong artifact paths.","triggerScenarios":"configured_candidates passes an env var whose value points to a directory, a deleted/not-yet-built binary, or a path with a typo/incorrect ~ expansion; the benchmark then aborts before starting any candidate.","commonSituations":"Forgot to run the build so the agent binary/jar was never produced; artifact moved after a refactor; absolute path from another machine baked into env; relative path resolved from the wrong working directory.","solutions":["Build the artifact first (go build / mvn package) so the file exists at the configured path","Correct the env var to the actual file location (note the path is expanduser().resolve()'d, so use an absolute path)","Delete the stale env value and re-export the current artifact path","In CI, add a build-and-verify step that asserts the artifact exists before the bench job"],"exampleFix":"// before\nexport JDBC_JAR=$PWD/target/old-name.jar   # FileNotFoundError\n// after\nmvn -q package && export JDBC_JAR=$PWD/target/argo-jdbc-1.0.jar\npython3 agent_compare.py","handlingStrategy":"validation","validationCode":"from pathlib import Path\np = Path(os.getenv(\"JDBC_JAR\", \"\")).expanduser().resolve()\nif not p.is_file():\n    raise SystemExit(f\"{p} is not a file — build the artifact first\")","typeGuard":null,"tryCatchPattern":"try:\n    artifact = required_path(\"ARGO_GO_AGENT\")\nexcept FileNotFoundError as e:\n    sys.exit(f\"artifact missing at {e}; run the build step first\")","preventionTips":["Run the build (go build / mvn package) before the bench in CI and locally","Use absolute paths resolved from the repo root, not stale machine-specific paths","Check the file exists after every build with a smoke `test -f` step","Re-export env vars after moving artifacts between directories"],"tags":["environment-variable","file-not-found","configuration"],"backgroundTag":"file-not-found","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"}