{"record":{"id":"955efb93b151d7fb","repo":"microsoft/autogen","slug":"could-not-find-autogen-repo-base-please-set-the-e","errorCode":null,"errorMessage":"Could not find AutoGen repo base. Please set the environment variable AUTOGEN_REPO_BASE to the correct value.","messagePattern":"Could not find AutoGen repo base\\. Please set the environment variable AUTOGEN_REPO_BASE to the correct value\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/agbench/src/agbench/run_cmd.py","lineNumber":591,"sourceCode":"    . ./global_finalize.sh\nfi\n\necho RUN.SH COMPLETE !#!#\n\"\"\"\n        )\n\n    # Figure out what folders to mount\n    volumes = {str(pathlib.Path(work_dir).absolute()): {\"bind\": \"/workspace\", \"mode\": \"rw\"}}\n\n    # Add the autogen repo if we can find it\n    autogen_repo_base = os.environ.get(\"AUTOGEN_REPO_BASE\")\n    if autogen_repo_base is None:\n        autogen_repo_base = find_autogen_repo(os.getcwd())\n    elif not os.path.isdir(autogen_repo_base):\n        raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), autogen_repo_base)\n\n    if autogen_repo_base is None:\n        raise ValueError(\n            \"Could not find AutoGen repo base. Please set the environment variable AUTOGEN_REPO_BASE to the correct value.\"\n        )\n\n    autogen_repo_base = os.path.join(autogen_repo_base, \"python\")\n    volumes[str(pathlib.Path(autogen_repo_base).absolute())] = {\"bind\": \"/autogen_python\", \"mode\": \"rw\"}\n\n    # Add the Docker socket if we are running on Linux\n    # This allows docker-out-of-docker to work, but provides access to the Docker daemon on the host.\n    # This maintains good isolation for experiment purposes (e.g., ensuring consistent initial conditions),\n    # but deminishes the security benefits of using Docker (e.g., when facing a deliberately malicious agent).\n    # since it would allow clients to mount privalaged images, volumes, etc.\n    docker_host = os.environ.get(\"DOCKER_HOST\", \"unix:///var/run/docker.sock\")\n    if docker_host.startswith(\"unix://\"):\n        docker_socket = os.path.abspath(docker_host[7:])\n        if os.path.exists(docker_socket):\n            st_mode = os.stat(docker_socket).st_mode\n            if stat.S_ISSOCK(st_mode):\n                volumes[docker_socket] = {\"bind\": \"/var/run/docker.sock\", \"mode\": \"rw\"}","sourceCodeStart":573,"sourceCodeEnd":609,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/agbench/src/agbench/run_cmd.py#L573-L609","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"# before\nagbench run /data/bench.jsonl  # run from ~/results, no autogen ancestor\n\n# after\nexport AUTOGEN_REPO_BASE=/home/me/src/autogen\nagbench run /data/bench.jsonl","handlingStrategy":"validation","validationCode":"import os, subprocess\nif \"AUTOGEN_REPO_BASE\" not in os.environ:\n    root = subprocess.run([\"git\", \"rev-parse\", \"--show-toplevel\"], capture_output=True, text=True)\n    if root.returncode == 0:\n        os.environ[\"AUTOGEN_REPO_BASE\"] = root.stdout.strip()","typeGuard":null,"tryCatchPattern":"try:\n    run_benchmark(...)\nexcept ValueError as e:\n    if \"AUTOGEN_REPO_BASE\" in str(e):\n        os.environ[\"AUTOGEN_REPO_BASE\"] = \"/path/to/autogen\"\n        run_benchmark(...)\n    else:\n        raise","preventionTips":["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."],"tags":["environment","repository-discovery","agbench"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}