My house uses well water, and the water from my tankless heater often runs cold. What's going on?
I have a house that had the same problem with a gas on-demand water heater, so I think I know what is causing the trouble.
With a well and pump system, the water flow may not be strong enough to turn the flow switch on at the tankless water heater. The flow switch requires 13 gallons per minute running through it to operate. With some well systems, the pump will cycle on and off and drop the flow down to next to nothing and then back up again. This will cause the on-demand water heater to cycle on and off.
To fix this problem you'll need to replace the pressure-compensating tank at the pump. I estimate this would cost about $500.