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

Fetch failed error #360

Open
shawncao opened this issue Feb 27, 2025 · 6 comments
Open

Fetch failed error #360

shawncao opened this issue Feb 27, 2025 · 6 comments
Assignees
Labels
component:other Questions unrelated to SDK status: awaiting user response Awaiting a response from the author type:bug Something isn't working type:help Support-related issues

Comments

@shawncao
Copy link

Description of the bug:

It seems having a high chance to hit failure, based on the error message, I'm not sure if this is SDK's issue or the model's issue. If you have some pointer, that would be great.

Often seeing this - more than 20% of the time? Since it says fetch failed, I'm wondering if this is something to do with the SDK or some client configurations.

[2025-02-27 11:47:16]: Failed to handle run status: Error: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent: fetch failed
[2025-02-27 11:47:32]: Chatting with user: [email protected]
history []
[2025-02-27 11:47:42]: Failed to handle run status: Error: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent: fetch failed

Actual vs expected behavior:

The service should be reliability give answer. But it often fails, my observation gives me ~20% of the chance.

Any other information you'd like to share?

No response

@hkt74 hkt74 self-assigned this Feb 28, 2025
@hkt74 hkt74 added type:bug Something isn't working component:js sdk Issue/PR related to JavaScript SDK labels Feb 28, 2025
@hkt74
Copy link
Collaborator

hkt74 commented Feb 28, 2025

Hi @shawncao

What is your runtime environment? I did some initial investigation, this error seems come from the low level fetch API. It looks like not from SDK (I couldn't find fetch failed error message from the repo) or API side (no http status code)

It would be helpful if you could provide the stack trace so we could debug further, thanks

@hkt74 hkt74 added type:help Support-related issues component:other Questions unrelated to SDK status: awaiting user response Awaiting a response from the author and removed component:js sdk Issue/PR related to JavaScript SDK labels Feb 28, 2025
@IvanLH IvanLH added component:js sdk Issue/PR related to JavaScript SDK and removed component:other Questions unrelated to SDK labels Mar 3, 2025
@H9660
Copy link

H9660 commented Mar 9, 2025

Hi @shawncao could you explain how can we replicate this behaviour for further debugging?

@shawncao
Copy link
Author

shawncao commented Mar 9, 2025

Hi, I can not repro this, this just randomly happened. I don't know if it is just the stability of Gemini service itself. If it is not related to the client lib, I can understand, we can close. Just want to bring it up to see if this is common for all users.

@0xdevalias
Copy link

0xdevalias commented Mar 11, 2025

There's not currently much extra info for it (hopefully they will provide some more details in time), but it looks like a humanify user may have just reported a similar issue:

It looks like they were running on Windows, and the stack trace seems to mention node:internal/deps/undici/undici:13502:13 as the source of the TypeError: fetch failed

Edit: They're running Node.js v22.14.0

I haven't looked deeply into this, but based on the error log you provided there, it seems to be happening within the @google/generative-ai package. Some potentially related issues from that upstream package:

From a google of "node internal deps undici", a few more potentially related issues popped up"

Originally posted by @0xdevalias in jehna/humanify#366 (comment)

@shawncao
Copy link
Author

It's pretty random, feels like it's service reliability issue, once in a while, but I'm not sure. by the way, I'm running node v22.14.0

@hkt74
Copy link
Collaborator

hkt74 commented Mar 12, 2025

Thanks @0xdevalias for sharing similar issues from other repos, particularly the stack trace shared in jehna/humanify#366 is very helpful. I also guess this might related to network connectivity issues, potentially due to firewall/proxy. (The issue happens randomly and hard to reproduce). If it is a Gemini api side issue, there should be a http status in the error message. I do found the same error message from the undici repo, which indicate it is a network error, without stack trace, it is hard to debug further.

@shawncao what do you think to close the issue for now and reopen when you have a detailed stack trace? thanks

@hkt74 hkt74 added component:other Questions unrelated to SDK and removed component:js sdk Issue/PR related to JavaScript SDK labels Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:other Questions unrelated to SDK status: awaiting user response Awaiting a response from the author type:bug Something isn't working type:help Support-related issues
Projects
None yet
Development

No branches or pull requests

5 participants