Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few days ago, there was no problem calling the API, but today there has been no successful access and an access exception has occurred #314

Open
Jianhong-user opened this issue Mar 20, 2024 · 1 comment
Labels
component:support How to do xyz? status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working

Comments

@Jianhong-user
Copy link

Description of the bug:

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "D: \ Python environment \ Project \ Gemini API \ pythonProject . venv \ Lib \ site packages \ Google \ api_core \ retry \ retry_unary. py", line 144, in retry_target

Result=target()

^^^^^^^^

File "D: \ Python_environment \ Project \ Gemini-Api \ pythonProject . venv \ Lib \ site packages \ Google \ api_core \ time out. py", line 120, in func_with_time out

Return fun (* args, * * kwargs)

^^^^^^^^^^^^^^^^^^^^^

File "D: \ Python environment \ Project \ Gemini API \ pythonProject . venv \ Lib \ site packages \ Google \ api_core \ grpc_helpers. py", line 78, in error remopped_callable

Raise exceptions. from grpc_error (exc) from exc

Google. api_core. exceptions ServiceUnavailable: 503 failed to connect to all addresses; Last error: UNKNOWN: ipv4:142.251.42.234:443: TCP handshake shutdown

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "D: \ Python environment \ Project \ Gemini-Api \ pythonProject \ Refactoring \ 1. py", line 18, in

"I plan to go to Japan and have always wanted to see cherry blossoms there."

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "D: \ Python environment \ Project \ Gemini-Api \ pythonProject . venv \ Lib \ site packages \ Google \ generateai \ generative_models. py", line 426, in send_message

Response=self. model. generate.content(

^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "D: \ Python environment \ Project \ Gemini-Api \ pythonProject . venv \ Lib \ site packages \ Google \ generateai \ generative_models. py", line 232, in generate.content

Response=self_ Client.generate_content(

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "D: \ Python environment \ Project \ Gemini API \ pythonProject . venv \ Lib \ site packages \ Google \ ai \ generativelanguage_v1beta \ services \ generative_service \ client. py", line 566, in generate.content

Response=rpc(

^^^^

File "D: \ Python environment \ Project \ Gemini-Api \ pythonProject . venv \ Lib \ site packages \ Google \ api_core \ gapic_v1 \ method. py", line 131, in __ call__

Return wrapped_fun (* args, * * kwargs)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "D: \ Python environment \ Project \ Gemini API \ pythonProject . venv \ Lib \ site packages \ Google \ api_core \ retry \ retry_unary. py", line 293, in retry_wrapped_fun

Return retry_target(

^^^^^^^^^^^^^

File "D: \ Python environment \ Project \ Gemini API \ pythonProject . venv \ Lib \ site packages \ Google \ api_core \ retry \ retry_unary. py", line 153, in retry_target

_Retryerror helper(

File "D: \ Python environment \ Project \ Gemini API \ pythonProject . venv \ Lib \ site packages \ Google \ api_core \ retry \ retry_base. py", line 221, in _retry_error_helper

Raise final_exc from source_exc

Google. api_core. exceptions RetryError: timeout of 60.0s exceeded, last exception: 503 failed to connect to all addresses

Actual vs expected behavior:

No response

Any other information you'd like to share?

No response

@Jianhong-user Jianhong-user added the type:bug Something isn't working label Mar 20, 2024
@singhniraj08 singhniraj08 added status:triaged Issue/PR triaged to the corresponding sub-team type:help Support-related issues component:support How to do xyz? and removed type:help Support-related issues labels Mar 20, 2024
@jhaayush2004
Copy link

These Steps may Resolve the Issue:

  1. Verify Network Configuration:

    • Ensure your environment can connect to the internet without restrictions like firewalls or proxy issues that might block the service.
    • Use network tools like ping or traceroute to check if the address 142.251.42.234:443 (the IP from the error) is reachable from your environment.
  2. Retry with Exponential Backoff:

    • Use an exponential backoff retry strategy to handle temporary service unavailability more gracefully. The retry delay should increase with each attempt to give the server more time to recover.
  3. Increase Timeout Settings:

    • The timeout error indicates that the connection attempt was limited to 60 seconds. Try increasing the timeout in your API calls to allow more time for the service to respond.
  4. Check API Quotas and Limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:support How to do xyz? status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants