t8y2/dbx · error · FileExistsError

Reusable Java agent package is not a file: {output}

Error message

Reusable Java agent package is not a file: {output}

What it means

When the reusable Java agent package (dbx-agent-<driver>-<version>.tar.zst) already exists but is not a regular file (e.g. a directory or symlink to nowhere), build_driver_zips raises FileExistsError instead of overwriting it. write_driver_tar_zstd is only invoked when the path doesn't exist at all.

Source

Thrown at agents/scripts/build_driver_zips.py:87

    for driver_name, driver in registry.get("drivers", {}).items():
        version = driver["version"]
        jar_artifact = driver.get("jar")
        if jar_artifact and jar_artifact.get("size", 0) > 0:
            filename = artifact_filename(jar_artifact["url"])
            source = release_dir / filename
            if not source.is_file():
                raise FileNotFoundError(f"Java agent artifact missing for {driver_name}: {source}")

            package_driver = copy.deepcopy(driver)
            package_driver.pop("native", None)
            package_driver["jar"] = packaged_artifact(jar_artifact, source)
            package_registry = {"jres": {}, "drivers": {driver_name: package_driver}}
            output = release_dir / f"dbx-agent-{driver_name}-{version}.tar.zst"
            if not output.exists():
                write_driver_tar_zstd(output, package_registry, source, executable=False)
            elif not output.is_file():
                raise FileExistsError(f"Reusable Java agent package is not a file: {output}")
            update_release_artifact(jar_artifact, output)
            outputs.append(output)

        for platform, artifact in driver.get("native", {}).items():
            filename = artifact_filename(artifact["url"])
            source = release_dir / filename
            if not source.is_file():
                raise FileNotFoundError(f"Native agent artifact missing for {driver_name}/{platform}: {source}")

            package_driver = copy.deepcopy(driver)
            package_driver.pop("jar", None)
            package_driver["native"] = {platform: packaged_artifact(artifact, source)}
            package_registry = {"jres": {}, "drivers": {driver_name: package_driver}}
            output = release_dir / f"dbx-agent-{driver_name}-{version}-{platform}.tar.zst"
            if not output.exists():
                write_driver_tar_zstd(output, package_registry, source, executable=True)
            elif not output.is_file():
                raise FileExistsError(f"Reusable native agent package is not a file: {output}")

View on GitHub (pinned to c0390bff16)

Solutions

  1. Remove or rename the non-file entry at release_dir/dbx-agent-<driver>-<version>.tar.zst so the script can write the package.
  2. Inspect the path with ls -la to see whether it's a directory, symlink, or other special file.
  3. Re-run the script after cleanup to regenerate a proper package.
  4. Add cleanup of stale/stray package paths to your release tooling.

Example fix

# before
out/dbx-agent-foo-1.0.0.tar.zst/   # stray directory
# after
rm -rf out/dbx-agent-foo-1.0.0.tar.zst && python build_driver_zips.py
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
out = Path("out/dbx-agent-foo-1.0.0.tar.zst")
if out.exists() and not out.is_file():
    raise SystemExit(f"{out} exists but is not a file; remove it")

Try / catch

try:
    build_driver_zips(release_dir)
except FileExistsError as e:
    print(f"{e}; deleting stale entry")
    # remove the reported path and retry once

Prevention

When it happens

Trigger: A directory named dbx-agent-<driver>-<version>.tar.zst exists in release_dir, or the path is a broken/special filesystem entry, so output.exists() is true but output.is_file() is false.

Common situations: An earlier failed script or manual extraction left a directory at that name; rsync/sync tools created placeholder directories; the filename collides with a folder used for unpacked contents.

Related errors


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