{"record":{"id":"a2136544581de8ed","repo":"abi/screenshot-to-code","slug":"eval-set-not-found-request-eval-set","errorCode":null,"errorMessage":"Eval set not found: {request.eval_set}","messagePattern":"Eval set not found: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"backend/routes/eval_sets.py","lineNumber":206,"sourceCode":"        sessions=[_session_to_model(s) for s in sessions],\n        active_session_id=active.session_id if active else None,\n    )\n\n\n@router.get(\"/eval-sessions/active\", response_model=Optional[EvalSessionModel])\nasync def get_active_eval_session() -> Optional[EvalSessionModel]:\n    active = eval_sessions.get_active_session()\n    return _session_to_model(active) if active else None\n\n\n@router.post(\"/eval-sessions\", response_model=EvalSessionModel)\nasync def create_eval_session(request: CreateEvalSessionRequest) -> EvalSessionModel:\n    try:\n        eval_sets.get_set(request.eval_set)\n    except eval_sets.InvalidSetNameError as e:\n        raise HTTPException(status_code=400, detail=str(e))\n    except eval_sets.EvalSetNotFoundError:\n        raise HTTPException(\n            status_code=404, detail=f\"Eval set not found: {request.eval_set}\"\n        )\n    session = eval_sessions.create_session(request.eval_set, request.name)\n    return _session_to_model(session)\n\n\n@router.post(\n    \"/eval-sessions/{session_id}/activate\", response_model=EvalSessionModel\n)\nasync def activate_eval_session(session_id: str) -> EvalSessionModel:\n    if eval_sessions.get_session(session_id) is None:\n        raise HTTPException(status_code=404, detail=\"Session not found\")\n    session = eval_sessions.activate_session(session_id)\n    assert session is not None\n    return _session_to_model(session)\n\n\ndef _is_stale_running(status: str, created_at: str) -> bool:","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/abi/screenshot-to-code/blob/d026163f586dfa8c5c10d28c36edd59a9d3b0e88/backend/routes/eval_sets.py#L188-L224","documentation":"Raised by POST /eval-sessions (404) when the eval_set name is well-formed but eval_sets.get_set() cannot find the set — same missing-set condition as GET /eval-sets/{name}, checked here so sessions always reference an existing set.","triggerScenarios":"POST /eval-sessions with a valid-format name that has no set directory: typo, deleted set, or a different evals data dir on this machine.","commonSituations":"Environment drift between machines (set exists locally, not on server); set renamed after the client cached the name; race with set deletion.","solutions":["GET /eval-sets first and POST with a name from that list.","Create the set before creating a session for it.","Verify EVALS_DIR configuration if the set should exist."],"exampleFix":"# before\nrequests.post(url + \"/eval-sessions\", json={\"eval_set\": \"jun-21-evals\"})  # 404\n\n# after\nnames = [s[\"name\"] for s in requests.get(url + \"/eval-sets\").json()]\nassert \"jun-21-evals\" in names, \"create the set first\"\nrequests.post(url + \"/eval-sessions\", json={\"eval_set\": \"jun-21-evals\"})","handlingStrategy":"validation","validationCode":"names = [s[\"name\"] for s in requests.get(url + \"/eval-sets\").json()]\nif payload[\"eval_set\"] not in names:\n    raise LookupError(f\"eval set {payload['eval_set']!r} missing; available: {names}\")\nrequests.post(url + \"/eval-sessions\", json=payload)","typeGuard":"def eval_set_exists(name: str, listing: list[dict]) -> bool:\n    return any(s.get(\"name\") == name for s in listing)","tryCatchPattern":"resp = requests.post(url + \"/eval-sessions\", json=payload)\nif resp.status_code == 404:\n    raise LookupError(\"create the eval set before starting a session for it\")\nresp.raise_for_status()","preventionTips":["Create/verify the set before creating sessions that reference it.","Re-list sets when switching machines or evals data dirs.","Distinguish 400 (bad name) from 404 (missing set) in error handling."],"tags":["fastapi","http-404","eval-sessions","eval-sets","lifecycle"],"backgroundTag":null,"analyzedSha":"d026163f586dfa8c5c10d28c36edd59a9d3b0e88","analyzedAt":"2026-08-14T22:02:06.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}