Package (Required)
Checked other resources
Example Code (Python)
model = ChatGoogleGenerativeAI(
location="us",
model="gemini-3.1-flash-lite",
vertexai=True,
)
response = model.invoke("How many planets are there in the solar system?")
print(response.text)
Error Message and Stack Trace (if applicable)
.venv\Lib\site-packages\langchain_google_genai\chat_models.py:3166: in _generate
response: GenerateContentResponse = self.client.models.generate_content(
.venv\Lib\site-packages\google\genai\models.py:5709: in generate_content
response = self._generate_content(
.venv\Lib\site-packages\google\genai\models.py:4371: in _generate_content
response = self._api_client.request(
.venv\Lib\site-packages\google\genai\_api_client.py:1401: in request
response = self._request(http_request, http_options, stream=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.venv\Lib\site-packages\google\genai\_api_client.py:1235: in _request
return retry(self._request_once, http_request, stream) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.venv\Lib\site-packages\tenacity\__init__.py:477: in __call__
do = self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.venv\Lib\site-packages\tenacity\__init__.py:378: in iter
result = action(retry_state)
^^^^^^^^^^^^^^^^^^^
.venv\Lib\site-packages\tenacity\__init__.py:400: in <lambda>
self._add_action_func(lambda rs: rs.outcome.result())
^^^^^^^^^^^^^^^^^^^
C:\Users\BejhanJetha\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\_base.py:449: in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
C:\Users\BejhanJetha\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\_base.py:401: in __get_result
raise self._exception
.venv\Lib\site-packages\tenacity\__init__.py:480: in __call__
result = fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
.venv\Lib\site-packages\google\genai\_api_client.py:1214: in _request_once
errors.APIError.raise_for_response(response)
.venv\Lib\site-packages\google\genai\errors.py:134: in raise_for_response
cls.raise_error(response.status_code, response_json, response)
.venv\Lib\site-packages\google\genai\errors.py:159: in raise_error
raise ClientError(status_code, response_json, response)
E google.genai.errors.ClientError: 404 Not Found. {'message': '<!DOCTYPE html>\n<html lang=en>\n <meta charset=utf-8>\n <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">\n <title>Error 404 (Not Found)!!1</title>\n <style>\n *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}\n </style>\n <a href=//www.google.com/><span id=logo aria-label=Google></span></a>\n <p><b>404.</b> <ins>That’s an error.</ins>\n <p>The requested URL <code>/v1beta1/projects/rxnt-ai-staging/locations/us/publishers/google/models/gemini-3.1-flash-lite:generateContent</code> was not found on this server. <ins>That’s all we know.</ins>\n', 'status': 'Not Found'}
Description
Google seems to be transitioning from single region to multi-region locations (us or eu) for Gemini 3+ models. Therefore, instead of specifying something like us-central1 for location, I am trying us. However, this results in a 404. The example code works with the global location.
Package (Required)
Checked other resources
Example Code (Python)
Error Message and Stack Trace (if applicable)
Description
Google seems to be transitioning from single region to multi-region locations (
usoreu) for Gemini 3+ models. Therefore, instead of specifying something likeus-central1forlocation, I am tryingus. However, this results in a 404. The example code works with thegloballocation.