t8y2/dbx · error · FileExistsError

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

Error message

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

What it means

Analogous to the Java case: if the reusable native package dbx-agent-<driver>-<version>-<platform>.tar.zst exists but is not a regular file, build_driver_zips raises FileExistsError rather than overwriting the non-file entry. This prevents clobbering unexpected filesystem objects like directories.

Source

Thrown at agents/scripts/build_driver_zips.py:105

                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}")
            update_release_artifact(artifact, output)
            outputs.append(output)

    registry_path.write_text(json.dumps(registry, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
    return outputs


def remove_raw_driver_artifacts(release_dir: Path) -> list[Path]:
    removed: list[Path] = []
    for path in sorted(release_dir.glob("dbx-agent-*")):
        if path.name.endswith(".tar.zst") or not path.is_file():
            continue
        path.unlink()
        removed.append(path)
    return removed


def main() -> None:

View on GitHub (pinned to c0390bff16)

Solutions

  1. Delete or rename the offending non-file entry at the reported path so the package can be written.
  2. Use ls -la to identify what the path actually is (directory vs symlink).
  3. Re-run the packaging script to regenerate the tar.zst.
  4. Clean stale package directories in release_dir as part of your release pipeline.

Example fix

# before
out/dbx-agent-foo-1.0.0-windows-amd64.tar.zst/  # stray directory
# after
rm -rf out/dbx-agent-foo-1.0.0-windows-amd64.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-windows-amd64.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}; remove the stale entry and rerun")

Prevention

When it happens

Trigger: A directory, symlink, or special file occupies the path release_dir/dbx-agent-<driver>-<version>-<platform>.tar.zst so output.exists() is true while output.is_file() is false.

Common situations: Extraction tooling created an unpacked directory with the package's name; interrupted script left a partial directory; case-insensitive filesystem collision with a similarly named folder.

Related errors


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