FreeTube icon indicating copy to clipboard operation
FreeTube copied to clipboard

[Bug]: `TypeError: Failed to fetch`

Open efb4f5ff-1298-471a-8973-3d47447115dc opened this issue 1 year ago • 16 comments

Guidelines

  • [X] I have encountered this bug in the latest release of FreeTube.
  • [X] I have searched the issue tracker for open and closed issues that are similar to the bug report I want to file, without success.
  • [X] I have searched the documentation for information that matches the description of the bug I want to file, without success.
  • [X] This issue contains only one bug.

Describe the bug

I sometimes get this error when just browsing FT and trying to fetch channels/videos/searches. Its very random and cant reproduce it consistently :(

image

First try recording yay, dont watch the whole vid i was trying to get it again in the vid but didnt succeed.

https://user-images.githubusercontent.com/73130443/232823415-e7533258-daf7-4f45-ac34-e4f0ea872a83.mp4

Ah i noticed that i can force it to throw the error if i switch pages very fast. U see the page shows content but if it would fetch it for the first time it wouldnt show any content and thats why this bug is so annoying. Sometimes i get it 3/4 times back to back so that would mean if i go to trending it will throw error and show me nothing. Then ill go to a channel i get the error and it shows nothing.

https://user-images.githubusercontent.com/73130443/232830298-00807eb7-c0b1-47c4-a0a6-753606d8d206.mp4

Expected Behavior

No fetching error :)

Issue Labels

content not loading, usability issue

FreeTube Version

https://github.com/FreeTubeApp/FreeTube/commit/2984df111222e4c849f099e8b0e974f96a998f60

Operating System Version

win10 22h2

Installation Method

.exe

Primary API used

Local API

Last Known Working FreeTube Version (If Any)

No response

Additional Information

No response

Nightly Build

It changed to

renderer.js:2 TypeError: Failed to fetch
    at hD.fetch (renderer.js:2:1361467)
    at hD.<anonymous> (renderer.js:2:1271638)
    at Generator.next (<anonymous>)
    at renderer.js:2:871590
    at new Promise (<anonymous>)
    at Iu (renderer.js:2:871335)
    at hD.fetch (renderer.js:2:1269423)
    at VO.<anonymous> (renderer.js:2:1312461)
    at Generator.next (<anonymous>)
    at renderer.js:2:871590

I always get this connection closed error before the failed to fetch error. That might be the real culprit.

connection_closed

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jun 24 '23 02:06 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jul 23 '23 01:07 github-actions[bot]

As a workaround, is there any chance FreeTube could be set to auto-retry when it encounters a connection closed error, until it goes through? Maybe a set amount of retries, configurable by the user, just so it never gets stuck in an infinite loop.

The main issue for me is that this failure triggers a fallback to invidious, which sometimes breaks things (especially comments section.) You can just disable the fallback and this avoids breakage, but then it defeats the purpose of a fallback being present in case Google changes something that breaks local API. It's still slightly annoying anyway because you have to reload things 2-3 times before it works, whenever this happens.

Can FreeTube tell the difference between connection closed, and actual API failure? So when it gets connection closed, it knows to just silently retry behind the scenes (so the user doesnt have to see errors every time it happens), but when local API is genuinely non-functional, it would know to stop trying.

Ammako avatar Jul 27 '23 16:07 Ammako

This is actually great. This was a low priority for our team because i was the only one getting this annoying bug. Hopefully we can address this sooner now that we know that this isn't actually a me problem

Yeah, actually I had no issues with 0.18.0 originally for some reason (like 3 weeks ago.) I have no idea why it worked for me because if I go back to 0.18.0 now, local API predictably errors out every time.

I've been dealing with those API errors for weeks and actually searched so many times on the issue tracker to see if others were having this problem. Unfortunately github issue tracker won't find existing issues unless you use the exact same wording that they did so I ended up missing yours.

Anyway. It seems like FreeTube actually does already auto-retry several times, but not always? There are times where I have to click again when it fails once, and there are times where I click once and get the error a couple times, and the content ends up loading in the end. Which to me suggests that FreeTube already tries several times.

If there's any information I could provide that would help figure out the root cause of this problem, I'd be happy to provide. I just don't know what would be relevant. It's not actually that big of a deal to me (which is why I waited so long before saying anything), but in the end I figured that if there is a known bug, you would probably appreciate it being reported before the next release, and not after.

Ammako avatar Jul 28 '23 12:07 Ammako

Yeah, actually I had no issues with 0.18.0 originally for some reason (like 3 weeks ago.) I have no idea why it worked for me because if I go back to 0.18.0 now, local API predictably errors out every time.

Just want to clarify a bit. The reason u didn't had this issue in 0.18.0 is because the change that introduced this error wasn't introduced in that version. This only happens in the nightly builds.

We had a migration of the Local API that took about 4 months to make it more stable so all the issues regarding the Local API ur seeing in v0.18.0 are not related to the ones u see in the nightly builds.

The Local API in v0.18.0 is probably fully broken now because YT changed to much on their end and that caused the old modules to break

TypeError: Failed to fetch is an error that is produced by the built-in fetch function. Not sure what makes YouTube decide to randomly close a connection. With a VPN I got the error occasionally but without a VPN I have never seen it, maybe YouTube doesn't like VPNs?

absidue avatar Aug 17 '23 17:08 absidue

Hmm could be i only use FT with VPN so i cant really comment on not getting this error without VPN

I wouldn't be surprised if it's just some kind of rate limiting from Google.

Ammako avatar Aug 19 '23 21:08 Ammako

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Sep 17 '23 01:09 github-actions[bot]

beep beep

Ammako avatar Sep 17 '23 01:09 Ammako

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Oct 16 '23 01:10 github-actions[bot]

I was unable to watch any videos or look at any channels while getting this error code. Adding it to my vpn's whitelist fixed it. Apparently when updating this program is gets removed from my VPN's whitelist. Probably has something to do with having to re-run the setup exe file on every update.

kirbyjohnson avatar Oct 20 '23 04:10 kirbyjohnson

In the meantime, could there be some kind of refresh button on all pages, like on the subscription feed page? Or maybe in the navigation bar alongside previous/next and new window.

Sometimes you load a video, or a channel profile page, or a playlist, etc. and it fails to fetch, so you get a blank video/profile page. but there's no way to refresh it until it works without clicking back and trying again, which can be problematic if the thing you clicked down was lower down a search results page, or in Up Next, or someone's profile in a comments section. You lost your spot on the previous page by clicking through, only to get a blank page with failed to fetch, and no way to reload the current page which means you have to dig through the previous page to find what you clicked on again.

You can kinda work around this by opening new window instead of clicking, then if it fails you still have your spot on the previous window and can try again. but the intuitive thing is to left-click, so sometimes you just do it mindlessly and then run into that problem again. For usability a way to refresh the current page would be really helpful (F5 doesn't work, either.)

Ammako avatar Oct 20 '23 23:10 Ammako

@Ammako use ctrl + r

A reload button is not going to be there for a while because we dont want reload buttons on every page. We want to make it one global reload button.

Edit: I just wanted to add this but u can also get this error when u have enabled a proxy. This issue is not related to that!

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Nov 19 '23 01:11 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Dec 19 '23 01:12 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jan 17 '24 01:01 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Feb 20 '24 01:02 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Mar 20 '24 01:03 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Apr 18 '24 01:04 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar May 17 '24 01:05 github-actions[bot]

This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Aug 07 '24 01:08 github-actions[bot]