If you just bought your house then check with your buyer's insurance policy. It may pay for the repairs or replacement. What model is your water heater? Read the model and serial numbers. Most likely it is the high temperature sensor and that means to replace the thermostat gas valve.