From fabce82c7dc7e8c35339f22bc06a88c2aa657a93 Mon Sep 17 00:00:00 2001 From: Gutts-n <57202549+Gutts-n@users.noreply.github.com> Date: Mon, 28 Sep 2026 10:44:51 -0300 Subject: [PATCH] Log raw NotFound detail in _read_schema --- .../infrastructure/engines/bigquery/backend.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/datastore/infrastructure/engines/bigquery/backend.py b/datastore/infrastructure/engines/bigquery/backend.py index d0f16da..84c82c7 100644 --- a/datastore/infrastructure/engines/bigquery/backend.py +++ b/datastore/infrastructure/engines/bigquery/backend.py @@ -170,7 +170,18 @@ def _read_schema(self, resource_id: str) -> dict | None: ref = f"{self.config.BIGQUERY_PROJECT}.{self.config.BIGQUERY_DATASET}.{resource_id}" try: table = self.client.get_table(ref) - except NotFound: + except NotFound as e: + # Google's tables.get 404 can mean "genuinely absent" or a + # masked authorization failure (some GCP APIs report 404 + # instead of 403 to avoid leaking existence). Log the raw + # response so an unexpected NotFound is diagnosable instead + # of silently indistinguishable from a real missing table. + log.debug( + "BigQuery tables.get NotFound for resource %r (ref=%r): %s", + resource_id, + ref, + e, + ) return None except Exception as e: raise ServerError(