t8y2/dbx · error · FileNotFoundError

{path}

Error message

{path}

What it means

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.

Source

Thrown at agents/drivers/cassandra-go/bench/agent_compare.py:293

        "p95_ms": percentile(ordered, 0.95),
        "p99_ms": percentile(ordered, 0.99),
    }


def percentile(values: list[float], fraction: float) -> float:
    if not values:
        return 0.0
    index = min(len(values) - 1, max(0, round((len(values) - 1) * fraction)))
    return values[index]


def required_path(name: str) -> Path:
    value = os.getenv(name, "")
    if not value:
        raise ValueError(f"{name} is required")
    path = Path(value).expanduser().resolve()
    if not path.is_file():
        raise FileNotFoundError(path)
    return path


def env_default(name: str, fallback: str) -> str:
    return os.getenv(name, "") or fallback


def env_int(name: str, fallback: int) -> int:
    value = int(env_default(name, str(fallback)))
    if value < 1:
        raise ValueError(f"{name} must be positive")
    return value


def env_float(name: str, fallback: float) -> float:
    value = float(env_default(name, str(fallback)))
    if value <= 0:
        raise ValueError(f"{name} must be positive")

View on GitHub (pinned to c0390bff16)

Solutions

  1. Build/copy the artifact so the printed path exists, or update the env var to the correct location
  2. Check the path is a file, not a directory
  3. Run from the correct working directory if the path was relative
  4. Verify ~ expansion resolves to the expected home on the runner

Example fix

// before
JDBC_AGENT_JAR=./old-path/agent.jar
// after
JDBC_AGENT_JAR=./target/agent-1.0.jar
Defensive patterns

Strategy: validation

Validate before calling

import os
from pathlib import Path

name = "JDBC_AGENT_JAR"
raw = os.getenv(name, "")
if raw:
    path = Path(raw).expanduser().resolve()
    if not path.is_file():
        raise SystemExit(f"{name} points to a missing file: {path} (build the artifact first?)")

Type guard

def is_existing_file(raw: str | None) -> bool:
    if not raw:
        return False
    path = Path(raw).expanduser().resolve()
    return path.is_file()

Try / catch

try:
    candidates = configured_candidates()
except FileNotFoundError as exc:
    sys.exit(f"artifact not found: {exc.filename} — build it or fix the env var path")

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/5e81bb85f321e473. Report an issue: GitHub.