Is it possible?determining one of the inputs at the end of the previous period (and borrowing based on ) and determining one of the inputs at the beginning of curent period after the shock

Hi,
I’m running my model, but I’m getting the Blanchard Kahn error. If possible, advise me on timing of my model.

The first case
In the first case, I considered that the firm buys capital(K) in the previous period, and , he(she) also buys labor(H) and S in the curent period and after the shock .The firm also borrows from the bank to buy capital.
I have defined the optimization problem as follows:

The second case
Then I thought it might be wrong for a firm to choose inputs at two points in time (capital in the previous period and H and S in the curent period and after the shock)

I decided to design the model so that all inputs were determined in the previous period. I
I have defined the optimization problem as follows:

image

The third case:
Should the The second case not be optimized as follows

Of course, derivation is also done wrt debt(-1) in the second case and debt in the third case

Do you think the first case is wrong? Also, if all the inputs are determined in the previous period, the second case is correct or the third case?
Thank you in advance for your guidance

The standard case is for capital to be predetermined one period in advance due to investment being chosen today but only being used for production tomorrow (time to build). In that case, your are still choosing capital today, but for tomorrow’s production. So you are right that the control is not K_{t-1}, but K_t. Still, due to capital being predetermined, it has a different timing in the production function. Please have a look at pretty much any textbook.