{"record":{"id":"43c3b8e0ec08b640","repo":"abi/screenshot-to-code","slug":"image-not-found","errorCode":null,"errorMessage":"Image not found","messagePattern":"Image not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"warning","filePath":"backend/routes/eval_sets.py","lineNumber":179,"sourceCode":"                sha256=image.sha256,\n                size_bytes=image.size_bytes,\n                tags=image.tags,\n            )\n            for image in images\n        ],\n    )\n\n\n@router.get(\"/eval-sets/{set_name}/images/{filename}\")\nasync def get_eval_set_image(set_name: str, filename: str) -> FileResponse:\n    try:\n        path = eval_sets.resolve_set_image_path(set_name, filename)\n    except eval_sets.InvalidSetNameError as e:\n        raise HTTPException(status_code=400, detail=str(e))\n    except eval_sets.EvalSetNotFoundError:\n        raise HTTPException(status_code=404, detail=f\"Eval set not found: {set_name}\")\n    except FileNotFoundError:\n        raise HTTPException(status_code=404, detail=\"Image not found\")\n    return FileResponse(path)\n\n\n@router.get(\"/eval-sessions\", response_model=EvalSessionListResponse)\nasync def list_eval_sessions() -> EvalSessionListResponse:\n    sessions = eval_sessions.list_sessions()\n    active = next((s for s in sessions if s.is_active), None)\n    return EvalSessionListResponse(\n        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","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/abi/screenshot-to-code/blob/d026163f586dfa8c5c10d28c36edd59a9d3b0e88/backend/routes/eval_sets.py#L161-L197","documentation":"Raised by GET /eval-sets/{set_name}/images/{filename} (404) when the set and inputs/ directory exist and the filename passed the .png check, but no file with that name is on disk (resolve_set_image_path raises FileNotFoundError at sets.py:302). It is the plain missing-file case.","triggerScenarios":"Requesting 'missing.png' for a set whose inputs directory lacks that file — typo, wrong set, or a file listed in a stale manifest that was deleted from disk.","commonSituations":"Manifest/filenames out of sync with disk after manual deletion; case-sensitivity mismatch (Shot.PNG vs shot.png on Linux); copying URLs between sets.","solutions":["List the set's actual images via GET /eval-sets/{set_name} and use an exact filename.","Check case: the extension check is case-insensitive but the filesystem lookup is exact.","Restore or re-add the missing image to inputs/ if a manifest still references it."],"exampleFix":"# before\nGET /eval-sets/my-set/images/hero01.png  # 404 'Image not found'\n\n# after\ndetail = requests.get(url + \"/eval-sets/my-set\").json()\nfname = detail[\"images\"][0][\"filename\"]\nGET /eval-sets/my-set/images/{fname}","handlingStrategy":"validation","validationCode":"detail = requests.get(url + f\"/eval-sets/{set_name}\").json()\nknown = {i[\"filename\"] for i in detail.get(\"images\", [])}\nif filename not in known:\n    raise LookupError(f\"{filename!r} not among {sorted(known)}\")","typeGuard":"def image_in_set(filename: str, detail: dict) -> bool:\n    return any(i.get(\"filename\") == filename for i in detail.get(\"images\", []))","tryCatchPattern":"resp = requests.get(url + f\"/eval-sets/{set_name}/images/{filename}\")\nif resp.status_code == 404 and \"Image not found\" in resp.text:\n    filename = next(i[\"filename\"] for i in requests.get(url + f\"/eval-sets/{set_name}\").json()[\"images\"])\n    resp = requests.get(url + f\"/eval-sets/{set_name}/images/{filename}\")\nresp.raise_for_status()","preventionTips":["Use exact filenames from the set detail response (case-sensitive on Linux).","Keep manifests and inputs/ in sync; don't delete files manually.","Re-list images after adding/removing files."],"tags":["fastapi","http-404","filesystem","eval-sets"],"backgroundTag":null,"analyzedSha":"d026163f586dfa8c5c10d28c36edd59a9d3b0e88","analyzedAt":"2026-08-14T22:02:06.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}