microsoft/autogen · error · FileNotFoundError
File {path} does not exist.
Error message
File {path} does not exist. What it means
FileNotFoundError raised by agbench's code_log CLI helper when the path passed to the 'code' command does not point to an existing file. The helper branches on os.path.isfile(path) and explicitly raises with the offending path when the check fails, before any LLM coding happens.
Source
Thrown at python/packages/agbench/src/agbench/linter/cli.py:39
def load_log_file(path: str, prepend_numbers: bool = False) -> Document:
with open(path, "r") as f:
lines = f.readlines()
if prepend_numbers:
lines = prepend_line_numbers(lines)
text = "".join(lines)
return Document(text=text, name=os.path.abspath(path))
def code_log(path: str) -> Optional[CodedDocument]:
coder = OAIQualitativeCoder()
if os.path.isfile(path):
doc = load_log_file(path, prepend_numbers=True)
coded_doc = coder.code_document(doc)
return coded_doc
else:
raise FileNotFoundError(f"File {path} does not exist.")
def print_coded_results(input_path: str, coded_doc: CodedDocument) -> None:
num_errors: int = 0
# define map from severity to ANSI color
severity_color_map = {2: "\033[31m", 1: "\033[33m", 0: "\033[32m"}
# sort the codes by severity with the most severe first
sorted_codes = sorted(coded_doc.codes, key=lambda x: x.severity, reverse=True)
for code in sorted_codes:
# select color based on severity, default to white if missing
color = severity_color_map.get(code.severity, "\033[37m")
print(f"{color}[{code.severity}]: {code.name}\033[0m: {code.definition}")
for example in code.examples:
print(f"\033[1m{input_path}\033[0m:{example.line}" f":{example.line_end}\t{example.reason}")
num_errors += 1
print("\n")View on GitHub (pinned to 027ecf0a37)
Solutions
- Check the path exists and is a file before invoking the command: os.path.isfile(path) / test -f.
- Use an absolute path or run the CLI from the directory containing the log file.
- If you expected the file to be generated by an earlier agbench step, verify that step succeeded first.
Example fix
# before agbench lint code runs/results/missing.jsonl # after ls runs/results/ # confirm the filename agbench lint code "$(pwd)/runs/results/actual_name.jsonl"
Defensive patterns
Strategy: validation
Validate before calling
import os, sys
path = sys.argv[1]
if not os.path.isfile(path):
sys.exit(f"error: no such file: {path}")
# safe to call the code command now Type guard
from pathlib import Path
def is_codable_log(p: str) -> bool:
return Path(p).is_file() and Path(p).stat().st_size > 0 Try / catch
try:
coded = code_log(path)
except FileNotFoundError as e:
print(f"Input not found: {e}. Check the path and cwd.")
raise SystemExit(2) Prevention
- Pass absolute paths to the CLI or verify cwd first.
- Check the file exists and is non-empty before invoking the command.
- Confirm upstream benchmark steps produced the log you mean to lint.
When it happens
Trigger: Running the agbench linter code command with a misspelled path, a directory instead of a file, a relative path resolved from the wrong working directory, or a file that was moved/deleted.
Common situations: Shell tab-completion typos; running the CLI from a different cwd so relative paths break; passing a glob that the shell did not expand; referencing benchmark output files that a previous step failed to write.
Related errors
- Failed to list MCP prompts
- Failed to get MCP prompt
- Failed to get MCP capabilities
- Failed to code the document.
- '{search_dir}' is not a directory.
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/d99f0bd325af6693.
Report an issue: GitHub.