{"record":{"id":"c3a5b9a3519934a0","repo":"OpenBMB/ChatDev","slug":"artifact-file-missing","errorCode":null,"errorMessage":"Artifact file missing","messagePattern":"Artifact file missing","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"server/routes/artifacts.py","lineNumber":88,"sourceCode":"    session_id: str,\n    artifact_id: str,\n    mode: str = Query(\"meta\", pattern=\"^(meta|stream)$\"),\n    download: bool = Query(False),\n):\n    manager, _ = _get_session_and_queue(session_id)\n    store = manager.attachment_service.get_attachment_store(session_id)\n    record = store.get(artifact_id)\n    if not record:\n        raise HTTPException(status_code=404, detail=\"Artifact not found\")\n\n    ref = record.ref\n    if mode == \"stream\":\n        local_path = ref.local_path\n        if not local_path:\n            raise HTTPException(status_code=404, detail=\"Artifact content unavailable\")\n        path = Path(local_path)\n        if not path.exists():\n            raise HTTPException(status_code=404, detail=\"Artifact file missing\")\n        media_type = ref.mime_type or \"application/octet-stream\"\n        disposition = \"attachment\" if download else \"inline\"\n        headers = {\"Content-Disposition\": f'{disposition}; filename=\"{ref.name}\"'}\n        return StreamingResponse(path.open(\"rb\"), media_type=media_type, headers=headers)\n\n    data_uri = ref.data_uri\n    if not data_uri and ref.local_path and (ref.size or 0) <= MAX_FILE_SIZE:\n        local_path = Path(ref.local_path)\n        if local_path.exists():\n            data_uri = encode_file_to_data_uri(local_path, ref.mime_type or \"application/octet-stream\")\n    return {\n        \"artifact_id\": artifact_id,\n        \"name\": ref.name,\n        \"mime_type\": ref.mime_type,\n        \"size\": ref.size,\n        \"sha256\": ref.sha256,\n        \"data_uri\": data_uri,\n        \"local_path\": ref.local_path,","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/OpenBMB/ChatDev/blob/4fb2db0ea90375ce1059f44fe03ffbd191a7a169/server/routes/artifacts.py#L70-L106","documentation":"The artifact record references a local file, but Path(local_path).exists() is false: the file was deleted or never fully written. The server 404s rather than streaming a missing file.","triggerScenarios":"GET .../artifacts/{id}?mode=stream after the underlying file in the attachment store was deleted, moved, or the workspace/warehouse directory was cleaned.","commonSituations":"Cleanup jobs or manual deletion of the warehouse directory; container restarts with ephemeral storage losing written files; partial writes from an interrupted run.","solutions":["Restore or regenerate the artifact by re-running the workflow","Check that the warehouse/attachment directory is on persistent storage if you need artifacts to survive restarts","Verify no cleanup process removes files while sessions are active","Inspect ref.local_path on the record to see where the file should be"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"import os\nref = client.get_artifact_meta(sid, aid)\nif ref.get('local_path') and not os.path.exists(ref['local_path']):\n    rerun_workflow(sid)  # regenerate artifacts","typeGuard":null,"tryCatchPattern":"try:\n    client.get_artifact(sid, aid, mode='stream')\nexcept HTTPError as e:\n    if e.response.json()['detail'] == 'Artifact file missing':\n        rerun_workflow(sid)  # regenerate then retry","preventionTips":["Keep warehouse storage persistent across restarts","Don't clean session directories while artifacts may still be fetched"],"tags":["http-404","artifacts","filesystem"],"backgroundTag":"file-not-found","analyzedSha":"4fb2db0ea90375ce1059f44fe03ffbd191a7a169","analyzedAt":"2026-08-27T14:35:29.622Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}