Error terminate called after throwing an instance of 'std::filesystem::__cxx11::filesystem_error'

Hello Colleagues and Dynare team,

I am trying to run my mod file using Dynare ver 6.1 and Matlab 2024. But I am getting the error message:
the largest simultaneous block has 32 equation(s)
and 32 feedback variable(s).
terminate called after throwing an instance of ‘std::filesystem::__cxx11::filesystem_error’
what(): filesystem error: cannot remove all: Access is denied [Base_Investment_Theta15/model/bytecode] [Base_Investment_Theta15/model/bytecode\block]
Preprocessing time: 0h00m01s.
Error using dynare (line 297)
Dynare: preprocessing failed

I have checked my mod file, but cannot figure out what is the problem. I have attached the mod file. Any help will be great! Ramani

Here is the mod file, I am trying to run. Base_Investment_Theta15.mod (7.8 KB)

That is an error message related to write access problems, triggered e.g. when operating in a cloud-synchronized folder. It often goes away after restarting Matlab.

Dear Dr. Pfeifer, Thanks for the response! As suggested, I restarted Matlab and tried to run the mod file. But the same problem occurred. Strangely, I am not having any problem running other mod files, even within the same directory. Do you think I should contact Matlab support or change variable/parameter names and try? Ramani

Sorry to bother once again. Just wanted to know if one faces similar problem if one uses OCTAVE instead of MALAB? Thanks Ramani

Can you close Matlab and try to manually delete the Base_Investment_Theta15 subfolder?

Thanks Dr. Jpfeifer! I deleted the subfolder and was able to run the mod file. However, when I tried to run it again, I had the same problem. So I again deleted the subfolder and was able to run it again. Every time I am trying run it I have to delete the subfolder. Weirdly, it is happening with this .mod file. I am able to run other mod files repeatedly without any problem. Ramani

  1. Are you on Windows?
  2. Can you copy the file to a separate folder on your disk where you have full write permissions. That folder must not be a network or cloud drive and should have a short path length. If you do so, can you still reproduce the error?

Thanks Dr. Pfeifer for all your help! As suggested I copied the file in a directory with full write permission. I ran it repeatedly and it works without problem. Hope that continues. If it still creates problem later, I will let you know!

Ok. Were you working in a subfolder of your Matlab directory before?

I had my files on one-drive. Now I saved my files on my downloads. There it works.
Base_Investment_Theta15.mod (8.0 KB)