Dynare Preprocessing Error: Can't open file xxxx_set_auxiliary_variables.m for writing

Dear all,

I get the following error message when I try to run dynare:

ERROR: Can’t open file rob30_set_auxiliary_variables.m for writing

Error using dynare (line 229)
DYNARE: preprocessing failed

I am using the dynare version 4.5.5 with Matlab 2017a. This is the first time ever that I experience this problem and it might have something to do that I have changed institutions.

I can run older mod files where the xxxx_set_auxiliary_variables.m file exists without any problems. I have attached the mod and steady state file. Could you please check whether the model runs on your machine?

It would be great if somebody could help me with this.



Post can be deleted. I found the mistake, for some reason there was a folder conflict.

We prefer to keep posts as other users may encounter the same issue.

I’m sorry, I first thought this problem was resolved. Unfortunately it is still there. I get the same error as above and I don’t know why. I’d be more than grateful if somebody could help me with this.

I have to mention that my all my files are stored on OneDrive (cloud). It seem when I move my files to the desktop and run them there, the error disappears. Have you experienced such a problem before?

Could it be that the created file name is not valid, i.e. is too long? Have you tried the root of the cloud drive?

@Robert Do you experience this problem with all your mod files stored in OneDrive? Or is it only with this specific mod file?

@sebastien, this also happened with other mod files on OneDrive. Do you have an idea what could cause the problem?

@jpfeifer I received this error message with the long file name when I copied my files on OneDrive. I will check you second remark over the weekend.

Thanks for both of your help.

@Robert When you run Dynare, it deletes and then re-creates several generated files (and in particular this _set_auxiliary_variables.m file).

My guess is that, for some reason, OneDrive does not play nice with such fast deletions-recreations, because it confuses the background daemon that monitors files on the disks and then synchronizes them with the cloud storage. In that case, there’s not much we can do, and the solution is to work outside the OneDrive folder.

Or it may be a filename length issue as suggested by @jpfeifer: is the full pathname of your folder long?

Hi Sebastien and Johannes,

I just quickly checked and it seems that the dynare error message arises due to a very long path name. Creating multiple subfolders and storing the files there leads to a large path and hence the error. For the future I will avoid doing that.

Thanks very much for both of your help!