Failed To Fetch Error

I am a teacher of a beginning coding class in P5 and our class project is to create a themed Maze Game with all the typical features of a maze. Since the students need to pick a theme, I’ve asked them to upload and display images, which I have taught before. Last Thursday, October 19, half of the students received a Failed to Fetch error, when trying to display images that they had loaded. The other half had no issues; I was reviewing their work today and trying to understand why the Failed to Fetch error appears. I have a link from the P5 editor where the error appears and another link from the openprocessing editor where the same code does not give the Failed to fetch error; in fact, the code works as intended. Any suggestions would be greatly appreciated, as the explanations I read in the forum about Failed to fetch went beyond my knowledge.
Thank you,
Ed

1 Like

Updating the situation… perhaps you have checked the links in my original post and seen that the Failed to fetch error no longer occurs. That was great, but today I had half my class with Failed to fetch errors . All of these students’ codes worked at the end of the previous class session. The other half of my class had no problems. I am wondering if there are any file upload limits that might be preventing some students’ files from loading?
I am also wondering if this can be attributed to P5 servers being overloaded. Perhaps I should track the times of day when the Failed to fetch errors occur
The problem occurs with jpeg, png and webp files. The problem sometimes goes away if I take the files out of an images folder and update the loadImage code accordingly with the new file path. Any suggestions would be greatly appreciated.

Hi, I’m having issue with the failed to fetch error in p5 web editor too. Here’s an exemple with a simple sketch only loading sound and image : p5.js Web Editor
If you comment the loadImage and image functions, you will notice sound is loaded properly.
I tried with different images and browsers and still having the same error.
Btw I tried running your sketch and it worked fine.

Hi sachatouille,

For the record, I tried your sketch and the graphic loaded, but that is not unexpected. When I or my students had the Failed to Fetch Error, the file loaded about 50% of the time over the course of a unit. (two weeks)
FYI - although the P5 online code editor is my first preference, I introduced my students to openprocessing.org and the ones who used it, did not see the failed to fetch error.
Good luck and let me know if you discover any way to fix it.

1 Like

Hello there friends, I’m new here in this forum, to be honest with you, I’m having this problem too, failed to fetch, when I run the sketch, it works fine at the first time but when I re run it again, it gives me this error message failed to fetch, & then, it freezes, & tells me to refresh the page, i don’t know what to do really?!!, I need your kind guidance & help, please, I’d appreciate your kind response, thank you

It is often helpful if a user experiencing a problem posts source code which demonstrates the problem. That way the potential helper can run the code and experience the problem for themselves and thereby possibly see a solution.

p5.js Web Editor | Thunder Legends (Zero - (Experimental)) (p5js.org)

here is the source code of the problem, I hope this is helpful to find a solution for it

I stopped and restarted it about five or six times in a Safari browser without error. Which browser are you using?

Ok Mr./Ms. svan, i use microsoft edge browser, but, guess what, i’ve restarted my laptop/computer, & it worked perfectly, no problem/no error, thank god, i hope it keeps workin fine that way forever, & anyways, thank you for your response & patient with me Mr/Ms. svan, i appreciate your help & care, thank you anyways

1 Like

My experience with students is that the problem occurs randomly… and indeed, with the same students, the very next class, the files will display. I think this thread is pointing out that there is a “failed to fetch” error, but until now, there is no surefire solution except to be patient or try your sketch in a different browser.

This seems to happen in the p5.js editor when trying to load a large amount of assets. For larger projects like yours, and if that’s an option for you, it might make sense to use a local development environment instead. VSCode is a popular option.

thanks for the suggestion @sableRaph … I have been testing with openprocessing and it seems to respond better. Here is the same file in the P5 editor and in the openprocessing editor

2 Likes