Check the pins at the ultrasonic sensor - I had one where I swapped the sensor, and still had the fault.
Looked closer at the pins, and one of them had corrosion on it, rather badly to the point where the wire pretty much came off in my hand.
I wired another pin in and that sorted it in that case.
I've also heard that if the key in ignition switch is intermittent or it thinks the key is always in the ignition, then that can cause an issue too - but it is far more common to be related to the ultrasonic sensor. If the little door doesn't come across the ignition barrel when the key is removed, then the barrel can be cleaned out with something like MAF or brake cleaner (something that doesn't leave a residue - don't use WD40 as it will allow dust etc to gum up) and then lubricate the lock barrel with some graphite powder.