# Failed To Fetch Error

**URL:** <https://discourse.processing.org/t/failed-to-fetch-error/43027>\
**Category:** Coding Questions\
**Created:** [October 22, 2023, 5:37pm UTC](https://discourse.processing.org/t/failed-to-fetch-error/43027 "2023-10-22T17:37:28Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![eharkins](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@eharkins](https://discourse.processing.org/u/eharkins)\
**Post date:** [October 22, 2023, 5:37pm UTC](https://discourse.processing.org/t/failed-to-fetch-error/43027/1 "2023-10-22T17:37:28Z")

</div>

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](https://editor.p5js.org/eharkins-DEMO/sketches/m-f4LaZJX) where the error appears and another link from the [openprocessing editor](https://openprocessing.org/sketch/2055202) 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

---

<div class="post-metadata">

**Author:** ![eharkins](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@eharkins](https://discourse.processing.org/u/eharkins)\
**Post date:** [October 25, 2023, 2:28pm UTC](https://discourse.processing.org/t/failed-to-fetch-error/43027/2 "2023-10-25T14:28:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sachatouille](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@sachatouille](https://discourse.processing.org/u/sachatouille)\
**Post date:** [January 12, 2024, 11:59am UTC](https://discourse.processing.org/t/failed-to-fetch-error/43027/3 "2024-01-12T11:59:32Z")

</div>

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](https://editor.p5js.org/sachatouille/sketches/l2-HH_A-f)  
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.

---

<div class="post-metadata">

**Author:** ![eharkins](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@eharkins](https://discourse.processing.org/u/eharkins)\
**Post date:** [January 16, 2024, 8:30pm UTC](https://discourse.processing.org/t/failed-to-fetch-error/43027/4 "2024-01-16T20:30:12Z")

</div>

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](http://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.

---

<div class="post-metadata">

**Author:** ![megarou76](https://avatars.discourse-cdn.com/v4/letter/m/b2d939/32.png) [@megarou76](https://discourse.processing.org/u/megarou76)\
**Post date:** [January 25, 2024, 8:04pm UTC](https://discourse.processing.org/t/failed-to-fetch-error/43027/5 "2024-01-25T20:04:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [January 25, 2024, 8:47pm UTC](https://discourse.processing.org/t/failed-to-fetch-error/43027/6 "2024-01-25T20:47:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![megarou76](https://avatars.discourse-cdn.com/v4/letter/m/b2d939/32.png) [@megarou76](https://discourse.processing.org/u/megarou76)\
**Post date:** [January 25, 2024, 9:59pm UTC](https://discourse.processing.org/t/failed-to-fetch-error/43027/7 "2024-01-25T21:59:41Z")

</div>

[p5.js Web Editor | Thunder Legends (Zero - (Experimental)) (p5js.org)](https://editor.p5js.org/megarou/sketches/AR4Nne3yU)

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

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [January 25, 2024, 10:29pm UTC](https://discourse.processing.org/t/failed-to-fetch-error/43027/8 "2024-01-25T22:29:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![megarou76](https://avatars.discourse-cdn.com/v4/letter/m/b2d939/32.png) [@megarou76](https://discourse.processing.org/u/megarou76)\
**Post date:** [January 25, 2024, 11:32pm UTC](https://discourse.processing.org/t/failed-to-fetch-error/43027/9 "2024-01-25T23:32:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![eharkins](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@eharkins](https://discourse.processing.org/u/eharkins)\
**Post date:** [January 26, 2024, 12:57pm UTC](https://discourse.processing.org/t/failed-to-fetch-error/43027/10 "2024-01-26T12:57:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sableraph](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sableraph/32/251_2.png) [@sableraph](https://discourse.processing.org/u/sableraph)\
**Post date:** [January 29, 2024, 1:44pm UTC](https://discourse.processing.org/t/failed-to-fetch-error/43027/12 "2024-01-29T13:44:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![eharkins](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@eharkins](https://discourse.processing.org/u/eharkins)\
**Post date:** [February 17, 2024, 6:43pm UTC](https://discourse.processing.org/t/failed-to-fetch-error/43027/13 "2024-02-17T18:43:22Z")

</div>

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](https://editor.p5js.org/eharkins-DEMO/sketches/yenxnXCvP) and in the openprocessing [editor](https://openprocessing.org/sketch/2181401)
