One giant prompt does five things badly. Split the work into steps, say what each one takes in, produces and is checked against, and the planner flags any step whose input nothing upstream actually produces.
A step is flagged when its input isn't the starting input and isn't produced by any earlier step — the usual cause of a chain that works once and then breaks.