abi/screenshot-to-code · warning · HTTPException
Folder not found: {folder}
Error message
Folder not found: {folder} What it means
404 raised by GET /evals in backend/routes/evals.py:62 when the folder query parameter names a path that does not exist on the backend host (Path(folder).exists() is False). The path is resolved against the backend's filesystem, not the browser's.
Source
Thrown at backend/routes/evals.py:62
for filename in os.listdir(input_dir):
if filename.endswith(".png"):
file_path = os.path.join(input_dir, filename)
files.append(InputFile(name=filename, path=file_path))
return sorted(files, key=lambda x: x.name)
except Exception as e:
raise HTTPException(
status_code=500, detail=f"Error reading input files: {str(e)}"
)
@router.get("/evals", response_model=list[Eval])
async def get_evals(folder: str):
if not folder:
raise HTTPException(status_code=400, detail="Folder path is required")
folder_path = Path(folder)
if not folder_path.exists():
raise HTTPException(status_code=404, detail=f"Folder not found: {folder}")
try:
evals: list[Eval] = []
# Get all HTML files from folder
files = {
f: os.path.join(folder, f)
for f in os.listdir(folder)
if f.endswith(".html")
}
# Extract base names
base_names: Set[str] = set()
for filename in files.keys():
base_name = (
filename.rsplit("_", 1)[0]
if "_" in filename
else filename.replace(".html", "")
)View on GitHub (pinned to d026163f58)
Solutions
- List valid folders with GET /eval_output_folders and pass one of those exact paths.
- If the folder should exist, verify it from the backend process's working directory (paths are server-side).
- Recreate or re-point the folder, then retry.
Defensive patterns
Strategy: validation
Validate before calling
const folders = await (await fetch('/eval_output_folders')).json();
const match = folders.find(f => f.path === folder);
if (!match) throw new Error(`Folder not available: ${folder}`); Try / catch
const res = await fetch(`/evals?folder=${encodeURIComponent(folder)}`);
if (res.status === 404) { /* re-list folders, let user re-pick */ } Prevention
- Only pass folder paths that came from the backend's own listing endpoint.
- Remember paths resolve on the backend host, not the browser machine.
When it happens
Trigger: GET /evals?folder=<path> where the path is relative to a different working directory, was deleted, or is a client-side path that does not exist server-side.
Common situations: Passing a macOS/Windows path from the developer machine while the backend runs in a container; the output folder was pruned between listing and fetch; relative path resolved against an unexpected CWD.
Related errors
- Image not found
- Error reading input files: {str(e)}
- Error processing evals: {str(e)}
- Error reading output folders: {str(e)}
- Text eval set not found: {set_name}
AI-assisted analysis of abi/screenshot-to-code@d026163f58 (2026-08-14).
Data as JSON: /api/errors/6da6eac18708597c.
Report an issue: GitHub.