# Issue with Dynare Preprocessor (4.6.1)

**URL:** https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448
**Category:** General DSGE Modeling
**Created:** [27 March 2020 15:20 UTC](https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448 "2020-03-27T15:20:30Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Jonathan](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.dynare.org/u/Jonathan)
#### Post date: [27 March 2020 15:20 UTC](https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448/1 "2020-03-27T15:20:30Z")

</div>

Dear Dynare team,

I recently updated to 4.6.1 and adapted my files to the new structure. However, I sometimes get the following error message:

Computing static model derivatives (order 1).  
Computing dynamic model derivatives (order 2).  
terminate called after throwing an instance of ‘std::filesystem::\_\_cxx11::filesystem\_error’  
what(): filesystem error: cannot remove all [YjLu0asVxy]  
Error using dynare (line 282)  
Dynare: preprocessing failed

This error appears randomly in about every second to third run but disappears upon restarting.

As most of my routines use several calls of dynare, this issue is quite disturbing. Is there a way to solve it?

Thank you for your time!

Best  
Jonathan

---

<div class="post-metadata">

### Author: ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)
#### Post date: [28 March 2020 07:04 UTC](https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448/2 "2020-03-28T07:04:20Z")

</div>

1. Is there a particular reason you are calling all of Dynare repeatedly? That is not recommended.
2. It sees that you are calling Dynare faster than the hard-disk and file system can process your calls. You may have to add a pause before running Dynare again.

---

<div class="post-metadata">

### Author: ![Jonathan](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.dynare.org/u/Jonathan)
#### Post date: [28 March 2020 11:56 UTC](https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448/3 "2020-03-28T11:56:38Z")

</div>

1. I wrote a little toolbox that directly generates nice looking graphs that can be directly integrated in LateX (or other programs). Basically it runs dynare for a specific model, collects the results, and then runs dynare for the next model.
2. I integrated some pause commands and for now it seems to work. Thank you very much! I think the problem might have been related to a connected Dropbox folder that updated the folders just the moment the dynare preprocessor wanted to delete them.

---

<div class="post-metadata">

### Author: ![yoy85](https://forum.dynare.org/letter_avatar_proxy/v4/letter/y/eada6e/32.png) [@yoy85](https://forum.dynare.org/u/yoy85)
#### Post date: [9 August 2021 17:42 UTC](https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448/4 "2021-08-09T17:42:17Z")

</div>

Dear @jpfeifer

I encounter the problem below when I run the model. I attached my mod file.

Thanks in advance…

Using 64-bit preprocessor  
Starting Dynare (version 4.6.4).  
Calling Dynare with arguments: none  
“/Applications/Dynare/4.6.4/matlab/preprocessor64/dynare\_m” model3.mod mexext=mexmaci64 “matlabroot=/Applications/MATLAB\_R2018a.app”: Aborted  
Starting preprocessing of the model file …  
Found 35 equation(s).  
Evaluating expressions…done  
Computing static model derivatives (order 1).  
Computing dynamic model derivatives (order 1).  
terminate called after throwing an instance of ‘std::filesystem::\_\_cxx11::filesystem\_error’  
what(): filesystem error: cannot create directory: File exists [model3]

[model3.mod](https://forum.dynare.org/uploads/short-url/p3QNbE5gdsBmGcpXIdalxKjcmO4.mod) (1.9 KB)

---

<div class="post-metadata">

### Author: ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)
#### Post date: [10 August 2021 07:03 UTC](https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448/5 "2021-08-10T07:03:37Z")

</div>

As detailed above, this is not an issue with a particular mod-file but with file access of the program to your hard drive.

---

<div class="post-metadata">

### Author: ![yoy85](https://forum.dynare.org/letter_avatar_proxy/v4/letter/y/eada6e/32.png) [@yoy85](https://forum.dynare.org/u/yoy85)
#### Post date: [10 August 2021 10:13 UTC](https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448/6 "2021-08-10T10:13:36Z")

</div>

I solved it thnks

---

<div class="post-metadata">

### Author: ![Spring](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@Spring](https://forum.dynare.org/u/Spring)
#### Post date: [14 August 2021 12:55 UTC](https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448/7 "2021-08-14T12:55:38Z")

</div>

> [@jpfeifer](#):
>
> It sees that you are calling Dynare faster than the hard-disk and file system can process your calls. You may have to add a pause before running Dynare again.

Hello Prof. Pfeifer,

Unfortunately, bother you again and again. I just met this problem. Could you please give me a sample code of adding a pause? I’m looping parameters in OSR.

Spring

---

<div class="post-metadata">

### Author: ![Spring](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@Spring](https://forum.dynare.org/u/Spring)
#### Post date: [14 August 2021 13:04 UTC](https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448/8 "2021-08-14T13:04:09Z")

</div>

OK, I searched in the forum and will try immediately

> [@Dynare has to run twice to execute at the second try](https://forum.dynare.org/t/dynare-has-to-run-twice-to-execute-at-the-second-try/16833/2):
>
> This happens when the sub-folder that Dynare needs to delete for a run is locked by some process. Usually closing Matlab once helps

---

<div class="post-metadata">

### Author: ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)
#### Post date: [14 August 2021 17:33 UTC](https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448/9 "2021-08-14T17:33:22Z")

</div>

That is strange. Are you looping over Dynare as a whole? That is strongly discouraged.

---

<div class="post-metadata">

### Author: ![Spring](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@Spring](https://forum.dynare.org/u/Spring)
#### Post date: [16 August 2021 02:48 UTC](https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448/10 "2021-08-16T02:48:17Z")

</div>

Hello Professor, thank you for your support!

I downloaded some sample codes from the forum, and I found looping inside Dynare doesn’t work. So unfortunately, I have to loop Dynare as a whole…

My looping codes are similar to the following fractions:

for the `m` file,

```auto
%welfare loss metric
welfare_loss_arr=zeros(length(epsilon_arr),length(phi_arr));

var_inflation = zeros(length(epsilon_arr),length(phi_arr));
var_outputgap=zeros(length(epsilon_arr),length(phi_arr));

%running the mode file and save the desired results
for ii=1:length(epsilon_arr)
    for jj=1:length(phi_arr)
        epsilon = epsilon_arr(ii);
        phi = phi_arr(jj);
        save parameterfile_welfare epsilon phi;
        dynare welfare_loss noclearall
        var_outputgap(ii,jj) = oo_.var(1,1);
        var_inflation(ii,jj) = oo_.var(2,2);
        welfare_loss_arr(ii,jj) = epsilon/lambda*var_inflation(ii,jj)+...
            (1+phi)*var_outputgap(ii,jj);
    end
end

```

For the `mod` file,

```auto
%mechansim on recursively running
load parameterfile_welfare;
set_param_value('epsilon',epsilon);
set_param_value('phi',phi);

```

and

```auto
shocks;
var eps_a; stderr 0.01; 
var eps_y_star; stderr 0; 
var eps_a_star; stderr 0;
end;

stoch_simul(irf=16,nograph,noprint) ygap pi_h R pi;

```

I read some topics discussing ‘‘looping over parameters’’, but they are too long. Would you please just modify these segments of codes to make MATLAB-Dynare accelerate?

Sincerely,

Spring

---

<div class="post-metadata">

### Author: ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)
#### Post date: [16 August 2021 06:28 UTC](https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448/11 "2021-08-16T06:28:25Z")

</div>

1. 

> [@Spring](#):
>
> I found looping inside Dynare doesn’t work

In such cases, always provide the full codes and the full error message.
2. 

> [@Spring](#):
>
> but they are too long

is not a good argument. Why should other people spend time on your problems if you are not willing to invest time?

---

<div class="post-metadata">

### Author: ![jer](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@jer](https://forum.dynare.org/u/jer)
#### Post date: [18 October 2023 12:40 UTC](https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448/12 "2023-10-18T12:40:09Z")

</div>

Ran into this problem myself as well. The issue was simply that I had at one point saved my code as a file without any file extension i.e. as “model\_name” instead of “model\_name.mod”. This meant that my code could not create a folder named “model\_name” as this was already taken.

Simply deleting the file without the file extension solved the problem.

---

<div class="post-metadata">

### Author: ![DiegoZamora](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/c0e974/32.png) [@DiegoZamora](https://forum.dynare.org/u/DiegoZamora)
#### Post date: [7 March 2024 19:53 UTC](https://forum.dynare.org/t/issue-with-dynare-preprocessor-4-6-1/15448/13 "2024-03-07T19:53:08Z")

</div>

In my case, I suppose this issue was related to having saved the “\*.mod” file without the “.mod” extension.
