I have encountered this error multiple times now, and although I somehow seem to get it fixed, I never know how.
I have one folder containing all files of a toolbox. When matlab analyses for dependencies outside the folder, it doesn't find any (as it should).
I have no clue why that happens, or how I sometimes seem to get around it.
I get an error saying that the toolbox packaging failed.
The resulting log-file:
"Beginning packaging process...
Failed to add files to 'C:\Users\Merkur\AppData\Local\Temp\tp0f62aa35_cf11_4e20_97b8_20689e0f1591.mltbx': File system entry already exists: /C__/Program Files/MATLAB/R2020a/toolbox/matlab/demos/why.m"
I have no clue what to do. I don't think brute-force repeating the process till it works is the way to go, although it did kinda work so far.
Yes, I did try restarting matlab, my pc, closing all scripts inside matlab before packaging, creating a new toolbox project instead of modifying the older project file when updating. I tried adding basically my entire drive as paths, and probably a few other things I can't remember right now.
For me, the error message doesn't really help. What I did notice is, that when repeating the process, the string of numbers and letters inside Temp\ is changing. If I try to look for the file, it doesn't exist.
Have a great day & stay safe