Upload 2 spreadsheets and merge datasets in python dash

The code in the plotly dash documentation is used to upload one file: Upload | Dash for Python Documentation | Plotly

When uploading one file, I was able to do this successfully (and modify the data) with my dataset before printing the resulting dataframe. The error printed above only comes up when I try to upload and modify two files in the same @callback.

I also found a similar (but more complicated?) problem on this forum without a complete solution: Upload 2 datasets, choose columns to merge on, get final merged output

Any idea why the same code works when uploading one file but fails when uploading two?