Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(bigquery): Retry on matched no files error (#86476)

Tomás Farías Santana6a47e0cd95b3
diff --git a/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.py b/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.py
index 4d93c554a613..bf08cbdaae47 100644
--- a/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.py
+++ b/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.py
@@ -1109,6 +1109,29 @@ class BigQueryClient:
await asyncio.sleep(backoff)
attempt += 1
except BadRequest as err:
+ if "matched no files" in str(err):
+ backoff = min(max_retry, initial_retry * (backoff_factor**attempt))
+ self.logger.warning(
+ "LoadJob could not find the uploaded file",
+ attempt=attempt,
+ backoff=backoff,
+ error_code=err.code,
+ exc_info=True,
+ )
+ self.external_logger.warning(
+ "BigQuery could not find the file we uploaded for a load job."
+ " This is usually a temporary issue on BigQuery's side. The load will be retried in %d"
+ " seconds, this is attempt number %d.",
+ backoff,
+ attempt,
+ attempt=attempt,
+ backoff=backoff,
+ error_code=err.code,
+ )
+ await asyncio.sleep(backoff)
+ attempt += 1
+ continue
+
if err.reason != "invalidQuery" or "Required field" not in str(err):
raise
try: