microsoft/autogen · error · ValueError
Could not find AutoGen repo base. Please set the environment
Error message
Could not find AutoGen repo base. Please set the environment variable AUTOGEN_REPO_BASE to the correct value.
What it means
Raised when AUTOGEN_REPO_BASE is unset and the automatic search (find_autogen_repo from the current working directory upward) failed to locate an AutoGen repository checkout. The benchmark needs the repo to mount it into the benchmark container, so a ValueError with remediation instructions is thrown.
Source
Thrown at python/packages/agbench/src/agbench/run_cmd.py:591
. ./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):
st_mode = os.stat(docker_socket).st_mode
if stat.S_ISSOCK(st_mode):
volumes[docker_socket] = {"bind": "/var/run/docker.sock", "mode": "rw"}View on GitHub (pinned to 027ecf0a37)
Solutions
- Set the environment variable explicitly: export AUTOGEN_REPO_BASE=/path/to/autogen (repo root containing the 'python' package dir).
- Or cd into a directory inside your AutoGen checkout before running so the upward search finds it.
- Verify the search target: ensure the checkout actually contains the markers find_autogen_repo looks for (e.g. the python/ subdirectory).
Example fix
# before agbench run /data/bench.jsonl # run from ~/results, no autogen ancestor # after export AUTOGEN_REPO_BASE=/home/me/src/autogen agbench run /data/bench.jsonl
Defensive patterns
Strategy: validation
Validate before calling
import os, subprocess
if "AUTOGEN_REPO_BASE" not in os.environ:
root = subprocess.run(["git", "rev-parse", "--show-toplevel"], capture_output=True, text=True)
if root.returncode == 0:
os.environ["AUTOGEN_REPO_BASE"] = root.stdout.strip() Try / catch
try:
run_benchmark(...)
except ValueError as e:
if "AUTOGEN_REPO_BASE" in str(e):
os.environ["AUTOGEN_REPO_BASE"] = "/path/to/autogen"
run_benchmark(...)
else:
raise Prevention
- Always set AUTOGEN_REPO_BASE explicitly in scripts and CI instead of relying on directory-walk discovery.
- Run agbench from inside the AutoGen checkout when the variable is unset.
When it happens
Trigger: Running agbench from a directory outside any AutoGen checkout with AUTOGEN_REPO_BASE unset, e.g. running from a scratch results directory or a cloned benchmark-only repo.
Common situations: Running the CLI from an arbitrary cwd (home dir, /tmp), fresh machines where the autogen repo is cloned somewhere the search does not reach, or CI jobs that check out only the benchmark package.
Related errors
- No such file or directory: '{autogen_repo_base}'
- Please set OPENAI_API_KEY environment variable.
- Please set ANTHROPIC_API_KEY environment variable.
- Missing ANTHROPIC_API_KEY environment variable.
- Missing ANTHROPIC_API_KEY environment variable.
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/955efb93b151d7fb.
Report an issue: GitHub.