microsoft/autogen · error · FileNotFoundError

No such file or directory: '{autogen_repo_base}'

Error message

No such file or directory: '{autogen_repo_base}'

What it means

agbench's run command raises FileNotFoundError(ENOENT) when the AUTOGEN_REPO_BASE environment variable is set but does not point to an existing directory. The value is trusted as-is; only when the variable is unset does the code fall back to searching for the repo.

Source

Thrown at python/packages/agbench/src/agbench/run_cmd.py:588

# Run the global finalize script if it exists
if [ -f global_finalize.sh ] ; then
    . ./global_finalize.sh
fi

echo RUN.SH COMPLETE !#!#
"""
        )

    # Figure out what folders to mount
    volumes = {str(pathlib.Path(work_dir).absolute()): {"bind": "/workspace", "mode": "rw"}}

    # Add the autogen repo if we can find it
    autogen_repo_base = os.environ.get("AUTOGEN_REPO_BASE")
    if autogen_repo_base is None:
        autogen_repo_base = find_autogen_repo(os.getcwd())
    elif not os.path.isdir(autogen_repo_base):
        raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), autogen_repo_base)

    if autogen_repo_base is None:
        raise ValueError(
            "Could not find AutoGen repo base. Please set the environment variable AUTOGEN_REPO_BASE to the correct value."
        )

    autogen_repo_base = os.path.join(autogen_repo_base, "python")
    volumes[str(pathlib.Path(autogen_repo_base).absolute())] = {"bind": "/autogen_python", "mode": "rw"}

    # Add the Docker socket if we are running on Linux
    # This allows docker-out-of-docker to work, but provides access to the Docker daemon on the host.
    # This maintains good isolation for experiment purposes (e.g., ensuring consistent initial conditions),
    # but deminishes the security benefits of using Docker (e.g., when facing a deliberately malicious agent).
    # since it would allow clients to mount privalaged images, volumes, etc.
    docker_host = os.environ.get("DOCKER_HOST", "unix:///var/run/docker.sock")
    if docker_host.startswith("unix://"):
        docker_socket = os.path.abspath(docker_host[7:])
        if os.path.exists(docker_socket):

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Verify the directory exists: `ls "$AUTOGEN_REPO_BASE"` and fix the export to the actual checkout root (the folder containing the 'python' subdirectory).
  2. If unsure, unset the variable (`unset AUTOGEN_REPO_BASE`) to let the automatic find_autogen_repo() search locate it from cwd.
  3. In CI, derive it dynamically: export AUTOGEN_REPO_BASE=$(git rev-parse --show-toplevel).

Example fix

# before
export AUTOGEN_REPO_BASE=~/src/autogen  # stale path

# after
export AUTOGEN_REPO_BASE="$(git -C ~/src/autogen rev-parse --show-toplevel)"
# or simply:
unset AUTOGEN_REPO_BASE
Defensive patterns

Strategy: validation

Validate before calling

import os
base = os.environ.get("AUTOGEN_REPO_BASE")
if base is not None and not os.path.isdir(base):
    raise SystemExit(f"AUTOGEN_REPO_BASE={base!r} is not a directory; unset it or fix the path")

Try / catch

try:
    run_benchmark(...)
except FileNotFoundError as e:
    if e.errno == errno.ENOENT and "AUTOGEN_REPO_BASE" in os.environ:
        sys.exit("AUTOGEN_REPO_BASE points to a missing directory; update or unset it")
    raise

Prevention

When it happens

Trigger: Exporting AUTOGEN_REPO_BASE to a stale, moved, or misspelled path (e.g. pointing at a deleted checkout or a file rather than a directory) and then running the benchmark.

Common situations: Repo checkout moved after the env var was set in shell profile/CI, container builds where the mount path differs from the host path, or trailing characters/typos in the export.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/4ef29eb1137dce7e. Report an issue: GitHub.