Upload image buttons in flask app don’t work anymore

I have a flask app, running locally, that I am trying to debug. There is some sort of issue with the response I am sending to the frontend, since the most recent commit (not related to the upload image buttons). I have cloned the repo with the code that works into a separate folder on my machine so I can gradually introduce changes until I find where I introduced problems in the response. I have been running this working app in the different folder fine. But now, when I switch to the original app that is ahead of the recent commit, I can’t even run it to reproduce the issue anymore because for whatever reason, the upload image button is now unresponsive. Somehow, running the copied code made the upload image buttons no longer work.

I have:
1.) Confirmed the copied working code is no longer running.
2.) Cleared the FireFox cache
3.) Tried using a different port
4.) Restarted my machine

I am on Ubuntu 20 if that matters.

Also, in the console, I see an error message pointing to a line in one of my template html files, but it is a line that does not exist (higher line number than lines in the file):

Uncaught SyntaxError: redeclaration of const msg
note: Previously declared at line 613, column 11

What else could be going wrong here?