I have had it quite a few times with these type of quests where I have set production going for something I tend not to use often and then forget to complete the quest after. I also forget to turn off the production so I end up wasting tons of expensive resources while also failing to finish the quest the production was started up for in the first place
I guess either having an extra popup to say the quest is ready to complete or being able to pay the resources early would help.
Regarding the issue of paying resources and then failing the quest, the resources could be "reserved" for the quest until it is complete rather than being spent straight away.
This works the same way as the trade office where resources being used in a trade are taken from storage and then returned to storage if the trade expires (or returned to star menu if storage is full once trade expires).