fix(providers): log the real Google error, not just the paraphrase
The reported failure now shows every model is unavailable through Vertex
on the second laptop, not only the newest one — meaning the fallback loop
(876b315) is running and exhausting all five candidates. That is a
genuinely different situation from "one new model isn't rolled out yet,"
and diagnosing it requires seeing what Google actually said.
Nothing was logged server-side before this: _gemini_error_message only
ever returned a paraphrase to the browser, and the fallback loop silently
swallowed a "not found" exception on every model but the last one with no
log line at all — four of five real error messages vanished before
anyone could read them.
Now: every exception this funnels through gets logged with its raw text
at the single point all callers pass through, and each skipped candidate
in the fallback loop logs before moving to the next. The next failure on
that laptop will show, in its own terminal, exactly what Google said for
every one of the five models tried — auth, permission, billing, or a
real 404 — instead of one collapsed sentence.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -73,7 +73,16 @@ _GEMINI_PROBE_MODEL_IDS: tuple[str, ...] = tuple(
|
||||
|
||||
|
||||
def _gemini_error_message(defn_name: str, exc: Exception) -> str:
|
||||
"""Convert Gemini SDK exceptions into concise UI messages."""
|
||||
"""Convert Gemini SDK exceptions into concise UI messages.
|
||||
|
||||
The full exception only ever reaches the browser as this paraphrase —
|
||||
"model does not exist" covers several genuinely different Google-side
|
||||
causes (wrong model, no Vertex permission, no billing, bad ADC). Log
|
||||
the raw text here, once, at the single point every caller funnels
|
||||
through, so diagnosing a live failure never depends on reproducing it
|
||||
a second time with more logging added.
|
||||
"""
|
||||
logger.warning("Gemini/Vertex request failed for %s: %s", defn_name, exc)
|
||||
error_msg = str(exc)
|
||||
lowered = error_msg.lower()
|
||||
invalid_markers = (
|
||||
@@ -361,6 +370,14 @@ async def _test_native_gemini_provider_connection(
|
||||
except Exception as exc:
|
||||
last_exc = exc
|
||||
if _is_model_not_found_error(exc):
|
||||
# Logged here, not just for the final attempt: without
|
||||
# this, four of five real Google error messages vanish
|
||||
# silently and only the last one is ever seen.
|
||||
logger.warning(
|
||||
"Gemini/Vertex probe: %s not found for %s, trying "
|
||||
"the next candidate. Raw error: %s",
|
||||
model_id, defn_name, exc,
|
||||
)
|
||||
continue
|
||||
return {
|
||||
"success": False,
|
||||
|
||||
Reference in New Issue
Block a user