Finding where it hurts is not the same as finding out why.
Root cause
Also called Symptom
The symptom is what you can see going wrong. The root cause is the earliest wrong thing that produced it, and the place where a fix ends it for good. A fix at the symptom only hides it, and it comes back somewhere else.
An agent told to "fix the NaN" will do exactly that, possibly by hiding the NaN, and the test it writes will agree. Keep asking why the value was wrong until you reach the place it was created.
Say it to your agent
“You removed the NaN, but why was it NaN? Trace the value back from the screen to where it first went wrong, tell me the file and line, and fix it there. Take out the || 0.”