diff --git a/matlab/+estimate/nls.m b/matlab/+estimate/nls.m
index 96009ab7d80e4ddb4194735e12b1872f944eb459..a6471f37141bc57c03b6652edb5cd19cb282e3dc 100644
--- a/matlab/+estimate/nls.m
+++ b/matlab/+estimate/nls.m
@@ -251,6 +251,13 @@ fprintf(fid, 'r = %s-(%s);\n', lhs, rhs);
 fprintf(fid, 's = r''*r;\n');
 fclose(fid);
 
+% Workaround for Octave bug https://savannah.gnu.org/bugs/?46282
+% Octave will randomly fail to read the ssr_* file generated in the +folder
+if isoctave
+    rename(['+' M_.fname], ['+' M_.fname '-tmp']);
+    rename(['+' M_.fname '-tmp'], ['+' M_.fname]);
+end
+
 % Create a function handle returning the sum of square residuals for a given vector of parameters.
 ssrfun = @(p) feval([M_.fname '.ssr_' eqname], p, DATA, M_, oo_);
 
@@ -456,4 +463,4 @@ if ~noprint
     dyn_table(title, preamble, afterward, oo_.nls.(eqname).pnames, ...
               {'Estimates','t-statistic','Std. Error'}, 4, ...
               [oo_.nls.(eqname).beta oo_.nls.(eqname).tstat sqrt(diag(C))]);
-end
\ No newline at end of file
+end
diff --git a/matlab/+pac/+estimate/nls.m b/matlab/+pac/+estimate/nls.m
index cb384cdf6181b46d476ef37a109d5d1e4efa338c..8dbb666516119b4682ef4f8c7d5f5e95afd8c3ce 100644
--- a/matlab/+pac/+estimate/nls.m
+++ b/matlab/+pac/+estimate/nls.m
@@ -164,6 +164,13 @@ fprintf(fid, 'r = %s-(%s);\n', lhs, rhs);
 fprintf(fid, 's = r''*r;\n');
 fclose(fid);
 
+% Workaround for Octave bug https://savannah.gnu.org/bugs/?46282
+% Octave will randomly fail to read the ssr_* file generated in the +folder
+if isoctave
+    rename(['+' M_.fname], ['+' M_.fname '-tmp']);
+    rename(['+' M_.fname '-tmp'], ['+' M_.fname]);
+end
+
 % Copy (sub)sample data in a matrix.
 DATA = data([range(1)-1, range]).data;