Your young company just made an epic mistake -- maybe your product is faulty, or a customer is just really (and rightfully) unhappy. You’re having night sweats and panic attacks. But take a deep breath and repeat four very important words: service recovery paradox theory. It’s a social science phenomenon, in which your occasional failures make customers trust you more. It helps them see you as human. But that doesn’t mean you’re off the hook. “The chances of customer retaliation will be reduced if the service provider has an efficient complaint-handling policy,” says Celso Augusto de Matos, a Brazilian marketing professor who has led research into the paradox theory.

Here’s what he means: You need an action plan—a way to show customers empathy, maintain an open line of communication and find the right compensation to regain their trust. (Cash never hurts.) Don’t have one yet? Consider these four crucial lessons from those who have been there and learned from their mistakes—because you, too, will screw up one day, like they did. It’s unavoidable. Be ready.

Do this:

Be a person.

Every product business is still a people business. Make a human connection with your customers to let them know your plan to remedy the situation.

Jamal Robinson thought he’d cracked the manufacturing problem. He runs an Indiana-based sunglasses startup called Desiar and wanted to add a line of wooden-framed glasses -- but had no idea how. Then a local furniture company approached him offering to build display cases, and Robinson upped the ante: Could they make the glasses, too? Sure, they said. So Robinson put his wooden-framed glasses up for sale, and they were his first big hit -- nearly 50 units pre-sold. But the final products kept breaking; the furniture company, well-intentioned as it was, just didn’t know how to make glasses frames. Some customers ended up with a faulty product, and others were just left waiting.

Robinson personally called every customer to explain the situation and promised a replacement to anyone whose glasses broke. Then he gave everyone his cellphone number so they could reach him anytime. “I told them that things hadn’t worked out as I thought and that we didn’t have an immediate solution but that we were working on one. They saw that we weren’t trying to hide anything,” he says. And because of that, he got zero requests for a refund. “If we gave them a great pair of glasses, hopefully they could understand we were doing our best.”

Do this:

Fess up immediately. Disclosing your mistake actually puts you in some command of the situation. Go on the offensive and reveal your error on your terms.

Ralph Clark is ceo of the Bay Area–company ShotSpotter, which uses electronic sensors to locate gunshots in cities and then alerts the authorities. “What we do is extremely challenging, and we’re not perfect,” Clark says. His sensors must identify gunshots -- and differentiate them from other bangs -- over noise as loud as highway traffic, and across wide and undulating landscapes. In its contract, ShotSpotter obligates itself to detect 80 percent of shots -- a high number (and it strives for higher), but still leaving a big window for failure when dealing with something as serious as potential homicides. And yet, the company’s annual customer attrition rate is less than 2.5 percent.

How? Clark says it’s because his company takes every failing very seriously—a “hair on fire” situation, he says. He invites clients to point out ShotSpotter’s mistakes, at which point the company will do exhaustive work on local sensors and review what went wrong. But more important, Clark says, the company searches on its own to locate its misses -- and then self-reports them to each client during a yearly review, along with what it learned about them. “Our clients appreciate that, because they don’t expect a vendor to [point out their errors],” says Clark.

Do this:

Budget for failure. You can give out an unlimited number of “sorrys,” but you should also plan on how to spend more limited resources.

In any business, big or small, mistakes can be costly. Many businesses have a policy for how, and when, to spend their way back into good graces. Houston-based Trumbull Unmanned is one of them. It operates drones, which major oil companies use to watch over their rigs and wells. Recently, the company was set to work a large environmental monitoring project, and a combination of equipment issues and shipping delays led to an operation that took 30 percent longer than originally estimated. Then, after all that, Trumbull discovered that it had some faulty data. So it told all this to its client, along with its action plan: It was going back to collect new data on its own dime. “We went back to make it right,” says CEO Dyan Gibbens, and the client stayed.

Some companies even have a line item on their budget just for failures. Backroads is a Northern California–based touring company that leads 30,000 people a year on trips to places like Africa, Myanmar and Tuscany -- where travel mishaps can quickly ruin a customer’s trip. That’s why CEO Tom Hale has set aside “hundreds of thousands of dollars” for refunds, which he has given out even if a problem wasn’t Backroads’ fault. “We bend over backward to make our guests feel really good about any and all interactions with the company,” Hale says. Most startups may not be able to set aside quite that much cash, but Hale suggests doing what you can. “If repeat business matters to you, if your reputation matters to you and you want to be the best you can be,” he says, then you need a way to quickly make things right.

Do this:

Just say no (sometimes). At the beginning, you’ll want to take on every gig that comes your way -- but it’s better to do a great job on the right project
than a poor job on the wrong one.

Altimeter Group provides data-strategy consulting services to the likes of Google, Salesforce and Cisco -- but in its early days, it had just one major customer. Signing that one was a big deal, but Altimeter’s founder and CEO, Charlene Li, began to regret it. The company wanted a lot of tactical specifics, but Altimeter had something different to offer. “After two weeks, we realized we couldn’t meet their expectations -- and rather than bashing our heads against the wall, we met with the client and said it wasn’t working,” Li says.

The client paid for the 10 percent of work done and walked away. It was gut-wrenching at the time, but it paid off quickly. The tech client came back the following year and signed Altimeter Group to a project that better fit its strengths. “People remember the feeling of trust,” Li says. “What you do today isn’t just for the sale.” She was candid about what her company could and couldn’t deliver, and the client remembered that more than a short-term failure.