{"record":{"id":"44b648be1b3e4929","repo":"t8y2/dbx","slug":"filenotfounderror-path","errorCode":null,"errorMessage":"FileNotFoundError(path)","messagePattern":"FileNotFoundError\\(path\\)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"agents/drivers/iotdb/bench/run.py","lineNumber":221,"sourceCode":"                \"round_mean_ms\": summarize([value[\"mean_ms\"] for value in values]),\n                \"round_p50_ms\": summarize([value[\"p50_ms\"] for value in values]),\n                \"round_p95_ms\": summarize([value[\"p95_ms\"] for value in values]),\n            }\n            for name, values in workloads.items()\n        },\n        \"rounds\": rounds,\n    }\n\n\ndef percentile(values: list[float], fraction: float) -> float:\n    index = max(0, min(len(values) - 1, int(len(values) * fraction + 0.999999) - 1))\n    return values[index]\n\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)))","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/iotdb/bench/run.py#L203-L239","documentation":"ensure_artifacts in the IoTDB benchmark script verifies that the required JDBC driver JAR and the Go benchmark binary exist on disk before benchmarking. If either path is missing it raises FileNotFoundError with the offending path. This fails fast so the benchmark doesn't crash later with a confusing subprocess error.","triggerScenarios":"Running main() when JDBC_JAR or GO_BINARY (predefined pathlib.Path constants) does not point to an existing regular file — the JAR was never downloaded, the Go binary was never built, or the script is run from a different working directory/environment than the one where artifacts were produced.","commonSituations":"Fresh clone where `go build` was skipped; CI cache evicted the JAR; artifacts placed at a different path after a refactor of the constants; running the bench script before the build step of a pipeline.","solutions":["Build/download the missing artifacts before running the script (e.g. run the go build step for GO_BINARY and fetch JDBC_JAR).","Verify the expected paths exist: ls the locations referenced by JDBC_JAR and GO_BINARY in run.py.","Run the script from the intended working directory so relative artifact paths resolve correctly.","Add a pre-flight step to CI that runs ensure_artifacts (or the equivalent checks) after building."],"exampleFix":"# before\npython agents/drivers/iotdb/bench/run.py\n# after\ngo build -o agents/drivers/iotdb/bench/bench-go ./bench-go && python agents/drivers/iotdb/bench/run.py","handlingStrategy":"validation","validationCode":"from agents.drivers.iotdb.bench.run import JDBC_JAR, GO_BINARY\nmissing = [p for p in (JDBC_JAR, GO_BINARY) if not p.is_file()]\nif missing:\n    raise SystemExit(f\"missing artifacts: {missing}\")","typeGuard":null,"tryCatchPattern":"try:\n    main()\nexcept FileNotFoundError as e:\n    print(f\"artifact missing: {e}; run the build step first\")","preventionTips":["Run the build/download step before the benchmark in CI","Add a preflight artifact check to the pipeline","Pin artifact paths and verify after every build","Never clean release dirs without regenerating artifacts"],"tags":["python","file-not-found","benchmark","build-artifacts"],"backgroundTag":"missing-build-artifact","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"}