There are many reasons that your safe can fail.
If it’s a dial safe, it’s possible for the wheel pack to drift causing the combination to change. If it’s a digital keypad it could be something as simple as low battery power.
The instance in the image here was the wiring from the white clip had become disengaged when an employee was changing the batteries. This stopped the keypad from communicating with the bolt retractor solenoid.
The first thing that will cause most safes to fail is poor quality overall. If you just go to your local hardware store or big box store or sporting goods store to get the cheapest thing in stock, expect to one day either have to call a locksmith or use a circular saw to cut the box in half to retrieve your valuables. They use plastic parts and cheap metals in their construction. That is how they keep their cost down.
The call to a local locksmith in most cases will run you about twice what you paid for a low end sporting goods store gun safe.
The main thing that you can do to ensure your safe keeps working is to spend the good money up front on a quality safe that will just simply work as it should for years and years. In the event that something should fail a good quality safe with included warranty coverage in most cases of factory defects will get your safe repaired or opened and replaced at no cost to you.
I trust and sell and use personally Hollon Safes. There are many other good quality safes out there as well. Too many to name but it is easy to research online. Quality can also vary between the same manufacturer. You should check for ratings such as burglary and fire. They will give you an idea of how long your safe will last if being attacked or how long your valuables will last if in a fire.
So, what do you do when your safe fails?
Start with the obvious things. Double check the combination. Double check the batteries if applicable. If the easy things have all been checked then it is time to call the locksmith.
Make sure that you are prepared with as much info as possible. Try to get your model and serial number handy. Have your manufacturer / brand and model name available as well. If you can, take good, clear pictures in good light of the dial / keypad, any logos, the hinges etc… Let the locksmith know if there is a key backup or a key dial lock. All of this information will allow your locksmith to research and find the best info to get into your safe with no or minimal damage.