microsoft/autogen · error · FileNotFoundError

No such file or directory: '{scenario}'

Error message

No such file or directory: '{scenario}'

What it means

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.

Source

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

    files: List[str] = []

    # Figure out which files or folders we are working with
    if scenario == "-" or os.path.isfile(scenario):
        files.append(scenario)
    elif os.path.isdir(scenario):
        for f in os.listdir(scenario):
            scenario_file = os.path.join(scenario, f)

            if not os.path.isfile(scenario_file):
                continue

            if not scenario_file.lower().endswith(".jsonl"):
                continue

            files.append(scenario_file)
    else:
        raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), scenario)

    # Run all the scenario files
    for scenario_file in files:
        scenario_name: Optional[str] = None
        scenario_dir: Optional[str] = None
        file_handle = None

        # stdin
        if scenario_file == "-":
            scenario_name = "stdin"
            scenario_dir = "."
            file_handle = sys.stdin
        else:
            scenario_name_parts = os.path.basename(scenario_file).split(".")
            scenario_name_parts.pop()
            scenario_name = ".".join(scenario_name_parts)
            scenario_dir = os.path.dirname(os.path.realpath(scenario_file))
            file_handle = open(scenario_file, "rt")

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Verify the path exists: `ls <scenario>` from the same directory you invoke the command from.
  2. Use an absolute path to eliminate cwd ambiguity.
  3. Check for typos, trailing whitespace, or shell-expansion issues in the path.

Example fix

# before
subprocess.run(["agbench", "run", "scenarios/typo.jsonl"])

# after
import os, sys
scenario = os.path.abspath("scenarios/bench.jsonl")
if not (os.path.isfile(scenario) or os.path.isdir(scenario)):
    sys.exit(f"scenario path not found: {scenario}")
Defensive patterns

Strategy: validation

Validate before calling

import os
if not (os.path.isfile(scenario) or os.path.isdir(scenario)):
    raise SystemExit(f"scenario path not found: {scenario}")

Try / catch

try:
    run_benchmark(scenario)
except FileNotFoundError as e:
    if e.errno == errno.ENOENT:
        sys.exit(f"Scenario not found: {e.filename}; check the path/cwd")
    raise

Prevention

When it happens

Trigger: 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.

Common situations: Wrong cwd when using relative paths, scenario files moved/renamed, path quoting issues with spaces, or CI checkout missing scenario fixtures.

Related errors


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