What is the reaction mechanism of a 5-endo-trig cyclization? I am trying to solve this mechanism for a disfavoured 5-endo-trig cyclisation to generate the disfavoured product (4) from starting material (1). The favoured 5-exo-trig is given by (2), which I have got a mechanism for. My efforts take me to intermediate (3) as shown below, but I'm not too sure on how to generate the desired product without reagent reduction.
Your mechanism to the 5-endo-trig product (4) is very close.  Notice however that when you do the initial cyclization, the intermediate formed has a positive charge on nitrogen along with the negative charge on oxygen (as you showed).  This cyclized intermediate then just needs to move a proton from the nitrogen to oxygen to form the neutral enol which then converts to the (ester) carbonyl - which is your desired product.  No other reagents are required.