OpenBMB/ChatDev · error · HTTPException

Artifact file missing

Error message

Artifact file missing

What it means

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.

Source

Thrown at server/routes/artifacts.py:88

    session_id: str,
    artifact_id: str,
    mode: str = Query("meta", pattern="^(meta|stream)$"),
    download: bool = Query(False),
):
    manager, _ = _get_session_and_queue(session_id)
    store = manager.attachment_service.get_attachment_store(session_id)
    record = store.get(artifact_id)
    if not record:
        raise HTTPException(status_code=404, detail="Artifact not found")

    ref = record.ref
    if mode == "stream":
        local_path = ref.local_path
        if not local_path:
            raise HTTPException(status_code=404, detail="Artifact content unavailable")
        path = Path(local_path)
        if not path.exists():
            raise HTTPException(status_code=404, detail="Artifact file missing")
        media_type = ref.mime_type or "application/octet-stream"
        disposition = "attachment" if download else "inline"
        headers = {"Content-Disposition": f'{disposition}; filename="{ref.name}"'}
        return StreamingResponse(path.open("rb"), media_type=media_type, headers=headers)

    data_uri = ref.data_uri
    if not data_uri and ref.local_path and (ref.size or 0) <= MAX_FILE_SIZE:
        local_path = Path(ref.local_path)
        if local_path.exists():
            data_uri = encode_file_to_data_uri(local_path, ref.mime_type or "application/octet-stream")
    return {
        "artifact_id": artifact_id,
        "name": ref.name,
        "mime_type": ref.mime_type,
        "size": ref.size,
        "sha256": ref.sha256,
        "data_uri": data_uri,
        "local_path": ref.local_path,

View on GitHub (pinned to 4fb2db0ea9)

Solutions

  1. Restore or regenerate the artifact by re-running the workflow
  2. Check that the warehouse/attachment directory is on persistent storage if you need artifacts to survive restarts
  3. Verify no cleanup process removes files while sessions are active
  4. Inspect ref.local_path on the record to see where the file should be
Defensive patterns

Strategy: fallback

Validate before calling

import os
ref = client.get_artifact_meta(sid, aid)
if ref.get('local_path') and not os.path.exists(ref['local_path']):
    rerun_workflow(sid)  # regenerate artifacts

Try / catch

try:
    client.get_artifact(sid, aid, mode='stream')
except HTTPError as e:
    if e.response.json()['detail'] == 'Artifact file missing':
        rerun_workflow(sid)  # regenerate then retry

Prevention

When it happens

Trigger: GET .../artifacts/{id}?mode=stream after the underlying file in the attachment store was deleted, moved, or the workspace/warehouse directory was cleaned.

Common situations: Cleanup jobs or manual deletion of the warehouse directory; container restarts with ephemeral storage losing written files; partial writes from an interrupted run.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27). Data as JSON: /api/errors/c3a5b9a3519934a0. Report an issue: GitHub.