Help understanding "Failed to fetch" errors w/ upload component, and debugging in general

I’m a very new Dash user.

I’d working on an etude that uploads files and displays a table of the results.

I’m cribbing/stealing blatantly from the Dash upload docs and other example (e.g. from docs.faculty.ai). The full source is over here at this gist.

It works, but every once in a while when I upload something I’ll get a pop-up in the browser window that says “Failed to fetch”, e.g.

I’m also seeing this in the console:

I’m running the app as python upload.py and the invoking the app object in upload.py like so:

app.run_server(debug=True, port=8888, host="172.16.193.97")

I can’t figure out a pattern, it doesn’t seem to be related to size or name or … It’s more likely to happen when I upload multiple files, but not necessarily. Also seems more like just after the page is refreshed.

Perhaps I need to be running multiple processes in the backend, or checking some status/ready flag?

While I’d love to figure out what’s going on, I’d also love to learn more about how to debug these types of errors?

  • What does this error actually mean?
  • Is there a way to dig into it from either the browser or backend?
  • Is there a Debugging manual somewhere that I’ve overlooked?
  • Often when I get errors they end up cascading and rolling off the top of the screen, particularly if I’ve killed the server. Is there a way to stop the event loop [SIC] that’s firing in the browser?
1 Like

I’ve also managed to provoke something similar with the docs.faculty.ai demo app

Changing my update_output to this:

 def update_output(list_of_contents, list_of_names, list_of_dates):
     """Save uploaded files and regenerate the file list."""

     if list_of_contents is None:
         raise PreventUpdate

     children = [
         n for c, n, d in zip(list_of_contents, list_of_names, list_of_dates)
     ]
     print(children)
     return children

seems to prevent the errors that I was seeing.

Does every callback need to check that it hasn’t been called with None?

From Dash 1.12.0 you can avoid it by using the prevent_initial_callbacks flag,

app = dash.Dash(prevent_initial_callbacks=True)

@emil – Thanks for the idea! If it were an initial callback thing, would I see it repeatedly?