{"record":{"id":"301d901e6621f385","repo":"microsoft/autogen","slug":"no-such-file-or-directory-scenario","errorCode":null,"errorMessage":"No such file or directory: '{scenario}'","messagePattern":"No such file or directory: '(.+?)'","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"python/packages/agbench/src/agbench/run_cmd.py","lineNumber":98,"sourceCode":"\n    files: List[str] = []\n\n    # Figure out which files or folders we are working with\n    if scenario == \"-\" or os.path.isfile(scenario):\n        files.append(scenario)\n    elif os.path.isdir(scenario):\n        for f in os.listdir(scenario):\n            scenario_file = os.path.join(scenario, f)\n\n            if not os.path.isfile(scenario_file):\n                continue\n\n            if not scenario_file.lower().endswith(\".jsonl\"):\n                continue\n\n            files.append(scenario_file)\n    else:\n        raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), scenario)\n\n    # Run all the scenario files\n    for scenario_file in files:\n        scenario_name: Optional[str] = None\n        scenario_dir: Optional[str] = None\n        file_handle = None\n\n        # stdin\n        if scenario_file == \"-\":\n            scenario_name = \"stdin\"\n            scenario_dir = \".\"\n            file_handle = sys.stdin\n        else:\n            scenario_name_parts = os.path.basename(scenario_file).split(\".\")\n            scenario_name_parts.pop()\n            scenario_name = \".\".join(scenario_name_parts)\n            scenario_dir = os.path.dirname(os.path.realpath(scenario_file))\n            file_handle = open(scenario_file, \"rt\")","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/agbench/src/agbench/run_cmd.py#L80-L116","documentation":"agbench's run command raises FileNotFoundError(ENOENT) when the scenario argument is neither an existing file nor an existing directory. The code checks earlier branches for a file and a directory; the final else assumes the path does not exist at all.","triggerScenarios":"Running the benchmark CLI with a scenario path that does not exist on disk, e.g. `agbench run ./scenarios/missing.jsonl`, or a typo'd directory name, or a relative path evaluated from the wrong working directory.","commonSituations":"Wrong cwd when using relative paths, scenario files moved/renamed, path quoting issues with spaces, or CI checkout missing scenario fixtures.","solutions":["Verify the path exists: `ls <scenario>` from the same directory you invoke the command from.","Use an absolute path to eliminate cwd ambiguity.","Check for typos, trailing whitespace, or shell-expansion issues in the path."],"exampleFix":"# before\nsubprocess.run([\"agbench\", \"run\", \"scenarios/typo.jsonl\"])\n\n# after\nimport os, sys\nscenario = os.path.abspath(\"scenarios/bench.jsonl\")\nif not (os.path.isfile(scenario) or os.path.isdir(scenario)):\n    sys.exit(f\"scenario path not found: {scenario}\")","handlingStrategy":"validation","validationCode":"import os\nif not (os.path.isfile(scenario) or os.path.isdir(scenario)):\n    raise SystemExit(f\"scenario path not found: {scenario}\")","typeGuard":null,"tryCatchPattern":"try:\n    run_benchmark(scenario)\nexcept FileNotFoundError as e:\n    if e.errno == errno.ENOENT:\n        sys.exit(f\"Scenario not found: {e.filename}; check the path/cwd\")\n    raise","preventionTips":["Prefer absolute paths (os.path.abspath) for CLI arguments.","Validate scenario paths in your runner script before invoking agbench."],"tags":["file-not-found","cli","path","agbench"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}