OpenBMB/ChatDev · error · HTTPException

Artifact not found

Error message

Artifact not found

What it means

get_artifact looked up artifact_id in the session's attachment store and got no record. The ID was never registered for this session or belongs to a different session's store.

Source

Thrown at server/routes/artifacts.py:79

        "next_cursor": next_cursor,
        "timed_out": timed_out,
        "has_more": queue.last_sequence > (next_cursor or 0),
    }
    return payload


@router.get("/api/sessions/{session_id}/artifacts/{artifact_id}")
async def get_artifact(
    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():

View on GitHub (pinned to 4fb2db0ea9)

Solutions

  1. Use the artifact ID exactly as reported in the workflow/artifact event payload
  2. Confirm the artifact ID belongs to this session_id
  3. Wait for the artifact-generated event before fetching
  4. Refresh IDs after a server restart
Defensive patterns

Strategy: try-catch

Validate before calling

artifact_ids = {e.artifact_id for e in client.poll_artifact_events(session_id)}
if artifact_id not in artifact_ids:
    raise LookupError(f'unknown artifact {artifact_id}')

Try / catch

try:
    client.get_artifact(session_id, artifact_id)
except HTTPError as e:
    if e.response.status_code == 404 and e.response.json()['detail'] == 'Artifact not found':
        refresh_artifact_ids(session_id)

Prevention

When it happens

Trigger: GET /api/sessions/{session_id}/artifacts/{artifact_id} where artifact_id doesn't exist in that session's attachment store (typo, stale ID from a previous run, or artifact from another session).

Common situations: Client persisted artifact IDs across server restarts that cleared stores; using an artifact ID from a different session; race where the artifact record isn't written yet when the client polls.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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