If you spawn a ship it should be so that an automatic repair template is saved (if this is really true I have no idea, I only see this in the P menu). To my understanding, a repair to template with T2 repair bay should work without problems if a) You haven't modified your ship (else you need to save a new template) b) you have added NO additional blocks to make provisory repairs or you have removed them all before starting the repair sequence. c) No obstacles go out of the repair zone and forbid the repair, also no hidden obstacles (half blocks, ramps going under the structure, retractable weapons etc) Despite of all that, the template stops working after some time. When does it stop working exactly? Good question but IDK, the message will be 'area blocked...' together with 'No repair blueprint available' which is both wrong. I add here expressly: This happens with a un-modified stock ship where the repair blueprint has shown to work at the same base, same type of damages. I cannot pinpoint the trouble factor which makes the repair blueprint useless at some point. Thanks to feedback your ongoings with repair templates!
You mention un-modified stock ship, but are you spawning that ship in a modded scenario? ...or are you seeing this in the vanilla game?
Vanilla survival game, the ship is the Merc-5E stock ship in its T2 state. I think you can reproduce the malfunction if after spawning it you DON'T save manually a repair template and you don't modify the ship. At my first repair attempt 200+ hours later (as for the P menu) the template didn't work like I have described. If I save immediately a template after spawning, and after each repair, it will apparently always work, I haven't had any issues if the repair parameters are correct.