One possible reason is Excel open file with some file name twice.
- Check whether there is any file in this folder. If there is, back up it and delete it.

- If you want to open two files with same file name, rename one of them to another name to open both files.
- If issue persist, share more detailed steps to reproduce your issue.
Thanks for the suggestion.
I went to the AutoRecover file location and deleted everything.
Then, with Excel closed, I went to Teams to open a file from there and got the same error.
When I went back to the AutoRecover location one of the folders I had deleted and one file were there again. I deleted them again, tried the routine, got the error and when I went back to the location, the same folder and same file appeared again.
The folder is called XLSTART and it is empty.
There is also a file (outside the folder) called Excel15.xlb
Any thoughts?