I am trying to replicate Corsetti-Dedola-Leduc RES 2008, but adding long-run growth. I keep running into the popular ‘Blanchard-Kahn conditions fail’ error, which corrects itself when I set exp(rex)=exp(cpif(-1))/exp(cpi(-1)), but this is not the correct timing. Can someone please help me out figure out where the mistake is? I’ve gone over the code several times and re-derived all equations, and I cannot figure it out. The mod file is attached.

rex is the exchange rate, which is defined in their paper as the ratio of foreign cpi (cpif) over domestic cpi (cpi). The exchange rate should not be predetermined, which makes me think there is an error related to timing somewhere else, but I cannot find it. Thanks in advance for your help!

Typically, this is a sign that some other equation (quite likely involving the real exchange rate) still has a timing problem. You should focus on the Euler equations.