{"record":{"id":"5e81bb85f321e473","repo":"t8y2/dbx","slug":"path-5e81bb","errorCode":null,"errorMessage":"{path}","messagePattern":"\\{path\\}","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"agents/drivers/cassandra-go/bench/agent_compare.py","lineNumber":293,"sourceCode":"        \"p95_ms\": percentile(ordered, 0.95),\n        \"p99_ms\": percentile(ordered, 0.99),\n    }\n\n\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 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\")","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/cassandra-go/bench/agent_compare.py#L275-L311","documentation":"After reading the env var, required_path resolves it and raises FileNotFoundError(path) when the path does not exist as a file. The message is just the resolved path, pointing you at exactly which artifact was not found.","triggerScenarios":"Env var like JDBC_AGENT_JAR is set but the resolved path (after expanduser/resolve) is not an existing regular file — build not run, artifact moved/deleted, relative path wrong relative to the runner's cwd, or it points at a directory.","commonSituations":"Forgetting `mvn package`/build before bench; artifact path valid on the dev machine but not in CI checkout; using ~ in a context where the expected home differs; path is a directory instead of the JAR.","solutions":["Build/copy the artifact so the printed path exists, or update the env var to the correct location","Check the path is a file, not a directory","Run from the correct working directory if the path was relative","Verify ~ expansion resolves to the expected home on the runner"],"exampleFix":"// before\nJDBC_AGENT_JAR=./old-path/agent.jar\n// after\nJDBC_AGENT_JAR=./target/agent-1.0.jar","handlingStrategy":"validation","validationCode":"import os\nfrom pathlib import Path\n\nname = \"JDBC_AGENT_JAR\"\nraw = os.getenv(name, \"\")\nif raw:\n    path = Path(raw).expanduser().resolve()\n    if not path.is_file():\n        raise SystemExit(f\"{name} points to a missing file: {path} (build the artifact first?)\")","typeGuard":"def is_existing_file(raw: str | None) -> bool:\n    if not raw:\n        return False\n    path = Path(raw).expanduser().resolve()\n    return path.is_file()","tryCatchPattern":"try:\n    candidates = configured_candidates()\nexcept FileNotFoundError as exc:\n    sys.exit(f\"artifact not found: {exc.filename} — build it or fix the env var path\")","preventionTips":["Build all artifacts (mvn package, go build, etc.) before invoking the bench","Prefer absolute paths for artifact env vars in CI","Add a preflight existence check for every configured path","Avoid directories-as-paths; point directly at the file (e.g. the .jar)"],"tags":["python","file-not-found","configuration","environment"],"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-14T00:17:10.932Z"}