{"record":{"id":"0671a045f848b862","repo":"browser-use/browser-use","slug":"no-response-from-model","errorCode":null,"errorMessage":"No response from model","messagePattern":"No response from model","errorType":"exception","errorClass":"ModelProviderError","httpStatus":500,"severity":"error","filePath":"browser_use/llm/google/chat.py","lineNumber":512,"sourceCode":"\n\t\t\t\t\t\t\t\t# Parse and validate\n\t\t\t\t\t\t\t\tparsed_data = json.loads(text)\n\t\t\t\t\t\t\t\treturn ChatInvokeCompletion(\n\t\t\t\t\t\t\t\t\tcompletion=output_format.model_validate(parsed_data),\n\t\t\t\t\t\t\t\t\tusage=usage,\n\t\t\t\t\t\t\t\t\tstop_reason=self._get_stop_reason(response),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\texcept (json.JSONDecodeError, ValueError) as e:\n\t\t\t\t\t\t\t\tself.logger.error(f'❌ Failed to parse fallback JSON: {str(e)}')\n\t\t\t\t\t\t\t\tself.logger.debug(f'Raw response text: {response.text[:200]}...')\n\t\t\t\t\t\t\t\traise ModelProviderError(\n\t\t\t\t\t\t\t\t\tmessage=f'Model does not support JSON mode and failed to parse JSON from text response: {str(e)}',\n\t\t\t\t\t\t\t\t\tstatus_code=500,\n\t\t\t\t\t\t\t\t\tmodel=self.model,\n\t\t\t\t\t\t\t\t) from e\n\t\t\t\t\t\telse:\n\t\t\t\t\t\t\tself.logger.error('❌ No response text in fallback mode')\n\t\t\t\t\t\t\traise ModelProviderError(\n\t\t\t\t\t\t\t\tmessage='No response from model',\n\t\t\t\t\t\t\t\tstatus_code=500,\n\t\t\t\t\t\t\t\tmodel=self.model,\n\t\t\t\t\t\t\t)\n\t\t\texcept Exception as e:\n\t\t\t\telapsed = time.time() - start_time\n\t\t\t\tself.logger.error(f'💥 API call failed after {elapsed:.2f}s: {type(e).__name__}: {e}')\n\t\t\t\t# Re-raise the exception\n\t\t\t\traise\n\n\t\t# Retry logic for certain errors with exponential backoff\n\t\tassert self.max_retries >= 1, 'max_retries must be at least 1'\n\n\t\tfor attempt in range(self.max_retries):\n\t\t\ttry:\n\t\t\t\treturn await _make_api_call()\n\t\t\texcept ModelProviderError as e:\n\t\t\t\t# Retry if status code is in retryable list and we have attempts left","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/browser-use/browser-use/blob/6c73fced2f6d45a11d88622fe56365a5fe18f28b/browser_use/llm/google/chat.py#L494-L530","documentation":"Raised in ChatGoogle's fallback path when response.text is empty ('No response text in fallback mode'): the model supports neither parsed output nor any usable text. ModelProviderError with status 500. Unlike [247] this branch is inside the generic retry loop, so the configured retry policy (max_retries with exponential backoff) may retry it before it propagates.","triggerScenarios":"Gemini returns an empty candidate (safety block, RECITATION finish, zero-token MAX_TOKENS finish, or API hiccup) while output_format is set and JSON mode is unavailable for the chosen model.","commonSituations":"Safety filters on scraping-heavy agent tasks; preview model outages; thinking budget consuming the entire token allowance leaving no visible text.","solutions":["Check candidates[0].finish_reason and safety ratings in the response to identify the empty-text cause","If thinking/reasoning consumed the budget, raise max_output_tokens or disable thinking config","Retry transient empties: the call sits inside the retry loop, so verify max_retries > 1","Switch models to one with JSON-mode support so response.parsed is populated"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"def is_empty_fallback_response(err: ModelProviderError) -> bool:\n    return err.message == 'No response from model'","tryCatchPattern":"except ModelProviderError as e:\n    if err.message == 'No response from model' and attempt < max_retries - 1:\n        await asyncio.sleep(2 ** attempt)\n        continue\n    raise","preventionTips":["Keep ChatGoogle max_retries >= 2 so empty transient responses are retried in-loop","Watch thinking/budget settings — reasoning can consume the entire output allowance","Alert on recurring empty responses; they indicate safety blocks or outages"],"tags":["google","gemini","empty-response","fallback","provider"],"backgroundTag":null,"analyzedSha":"6c73fced2f6d45a11d88622fe56365a5fe18f28b","analyzedAt":"2026-08-14T19:42:40.557Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}