diff --git a/backend/pashub_fetcher/pashub_client.py b/backend/pashub_fetcher/pashub_client.py index 11cf403c7..aadaed41f 100644 --- a/backend/pashub_fetcher/pashub_client.py +++ b/backend/pashub_fetcher/pashub_client.py @@ -192,7 +192,17 @@ class PashubClient: r.raise_for_status() - results = r.json().get("results", []) + payload: Dict[str, Any] = r.json() + results: List[Dict[str, Any]] = payload.get("results", []) + total: int = payload.get("totalItemCount", len(results)) + + if len(results) < total: + raise TruncatedEvidenceListError( + f"PasHub returned {len(results)} of {total} evidence files for job " + f"{job_id} - the response was truncated and the evidence set is " + f"incomplete. Increase _EVIDENCE_PAGE_SIZE in pashub_client.py " + f"above {total} and re-run." + ) return [EvidenceFileData.from_api(item) for item in results]