{"record":{"id":"95beee13ed675fba","repo":"microsoft/autogen","slug":"search-dir-is-not-a-directory","errorCode":null,"errorMessage":"'{search_dir}' is not a directory.","messagePattern":"'(.+?)' is not a directory\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/agbench/src/agbench/tabulate_cmd.py","lineNumber":37,"sourceCode":"SUCCESS_STRINGS = [\n    \"ALL TESTS PASSED !#!#\",\n]\n\nCOMPLETED_STRINGS = [\n    \"SCENARIO.PY COMPLETE !#!#\",\n]\n\nEXCLUDE_DIR_NAMES = [\"__pycache__\"]\n\nTIMER_REGEX = r\"RUNTIME:\\s*([\\d.]+) !#!#\"\n\n\ndef find_tabulate_module(search_dir: str, stop_dir: Optional[str] = None) -> Optional[str]:\n    \"\"\"Hunt for the tabulate script.\"\"\"\n\n    search_dir = os.path.abspath(search_dir)\n    if not os.path.isdir(search_dir):\n        raise ValueError(f\"'{search_dir}' is not a directory.\")\n\n    stop_dir = None if stop_dir is None else os.path.abspath(stop_dir)\n\n    while True:\n        path = os.path.join(search_dir, TABULATE_FILE)\n        if os.path.isfile(path):\n            return path\n\n        path = os.path.join(search_dir, \"Scripts\", TABULATE_FILE)\n        if os.path.isfile(path):\n            return path\n\n        path = os.path.join(search_dir, \"scripts\", TABULATE_FILE)\n        if os.path.isfile(path):\n            return path\n\n        # Stop if we hit the stop_dir\n        if search_dir == stop_dir:","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/agbench/src/agbench/tabulate_cmd.py#L19-L55","documentation":"agbench's tabulate command validates its search_dir argument up front: after abspath normalization, if the path is not an existing directory it raises ValueError. This is an input validation error before the upward directory walk for the tabulate script begins.","triggerScenarios":"Calling the tabulate CLI/function with a results directory path that does not exist or is actually a file, e.g. pointing at a results.json file instead of its parent folder, or a typo'd/benchmark-not-yet-run directory.","commonSituations":"Tabulating before the benchmark run created the output directory, passing a file where a directory is expected, relative paths from the wrong cwd, or cleaned-up temp results.","solutions":["Confirm the path is a directory and exists: `ls -d <path>`.","Pass the benchmark's output/run directory, not an individual results file.","Run the benchmark first if the results directory has not been created yet."],"exampleFix":"# before\nagbench tabulate results/run1.json\n\n# after\nagbench tabulate results/run1/","handlingStrategy":"validation","validationCode":"import os\nsearch_dir = os.path.abspath(search_dir)\nif not os.path.isdir(search_dir):\n    raise SystemExit(f\"{search_dir} is not a directory; pass the benchmark results directory\")","typeGuard":null,"tryCatchPattern":"try:\n    tabulate(search_dir)\nexcept ValueError as e:\n    if \"is not a directory\" in str(e):\n        sys.exit(\"Pass the run/results directory to tabulate, not a file\")\n    raise","preventionTips":["Chain commands so tabulate only runs after a successful benchmark run produced the directory.","Use os.path.dirname on result file paths to derive the directory programmatically."],"tags":["path","validation","cli","agbench"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}