The issue was due to the fact my path contained a deployed application.
Apperntly from R2020a and on the deployed applicartion contains a copy of the source code and this somehow causes this error.
By removing the folder containing the deployed application from my path the issue was solved.