{"record":{"id":"e823ab678be71e26","repo":"abi/screenshot-to-code","slug":"error-processing-evals-str-e","errorCode":null,"errorMessage":"Error processing evals: {str(e)}","messagePattern":"Error processing evals: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"backend/routes/evals.py","lineNumber":104,"sourceCode":"                continue\n\n            # Find matching output file\n            output_file = None\n            for filename, filepath in files.items():\n                if filename.startswith(base_name):\n                    output_file = filepath\n                    break\n\n            if output_file:\n                input_data = await image_to_data_url(input_path)\n                with open(output_file, \"r\", encoding=\"utf-8\") as f:\n                    output_html = f.read()\n                evals.append(Eval(input=input_data, outputs=[output_html]))\n\n        return evals\n\n    except Exception as e:\n        raise HTTPException(status_code=500, detail=f\"Error processing evals: {str(e)}\")\n\n\nclass RunEvalsRequest(BaseModel):\n    models: List[str]\n    stack: Stack\n    files: List[str] = []  # Optional list of specific file paths to run evals on\n    diff_mode: bool = False\n    # When set, inputs come from {EVALS_DIR}/sets/{set_name}/inputs and runs\n    # attach to the active eval session (auto-created when none exists).\n    set_name: Optional[str] = None\n\n\ndef _resolve_set_run(\n    request: RunEvalsRequest,\n) -> tuple[Optional[str], Optional[eval_sessions.EvalSession], Dict[str, set[str]]]:\n    \"\"\"Validate the requested set and resolve the session + per-model skips.\"\"\"\n    if not request.set_name:\n        return None, None, {}","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/abi/screenshot-to-code/blob/d026163f586dfa8c5c10d28c36edd59a9d3b0e88/backend/routes/evals.py#L86-L122","documentation":"500 raised by GET /evals in backend/routes/evals.py:104 as a catch-all for any exception while scanning the folder for .html files, reading output HTML, or converting input images to data URLs (image_to_data_url). The detail embeds the underlying exception string, which is the real diagnostic.","triggerScenarios":"The folder stops existing mid-scan (deleted between the exists() check and listdir), an .html output file is unreadable (permissions), or an input .png referenced by the pairing logic is missing/corrupt so image_to_data_url raises.","commonSituations":"Concurrent cleanup deleting eval outputs while the endpoint iterates; mismatched input/output basenames causing a missing-file read; unreadable files under restrictive permissions.","solutions":["Read the detail field of the 500 response — it contains the original exception message (e.g. FileNotFoundError with the exact path).","Fix the named file/directory: restore the missing png/html pair or permissions.","Re-run after ensuring the folder contents are stable (no cleanup job running concurrently)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const evals = await fetch(`/evals?folder=${encodeURIComponent(folder)}`).then(r => {\n    if (!r.ok) throw new Error(`HTTP ${r.status}`);\n    return r.json();\n  });\n} catch (e) {\n  // detail field carries the root-cause exception; surface it verbatim\n  console.error('Eval scan failed:', e.message);\n}","preventionTips":["Treat any 500 detail here as the underlying OS error message — read it before retrying.","Avoid deleting/pruning output folders while eval listings are in flight."],"tags":["http-500","filesystem","evals","fastapi"],"backgroundTag":null,"analyzedSha":"d026163f586dfa8c5c10d28c36edd59a9d3b0e88","analyzedAt":"2026-08-14T22:02:06.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}