Our group has created a repair guide for the Canon SX40HS digital camera for use by people wanting to dissasemble and or repair their own camera. The guide will contain a troubleshooting page, pictures, and 3 repair guides for common issues with this particular model.
If your lens is removable, try taking it off and cleaning the contacts is isopropyl alcohol. Just a little on a swab. Re attach it and see if the error returns. Also try going in to your settings and selecting clean cmos if it has the option.