Even when you think you’ve hired the right contractor, your project can go wrong. But all is not lost, as long as the contractor was licensed. (You have next to no legal recourse against unlicensed contractors, and some jurisdictions even come after homeowners for ­hiring them.) Here are your options:

Stop paying. Many contractors ask for half of their payment upfront before they begin a job. Bad idea. You should pay no more than one-third of the agreed-upon fee in advance; in some states, this is the law. After that, structure the contract so that you pay upon completion of specific chunks of the project. That way, if you reach an impasse over work that hasn’t been done correctly, or at all, you can withhold payment. Hopefully, the contractor will make things right to get his or her money.

Complain. Because you hired a licensed contractor, you can file a complaint with the government agency that licensed them. That body, whether county or state, should then help settle your dispute. Because contractors fear losing their license, sometimes the mere threat of such a complaint will do the trick. You can also appeal to your county and/or state consumer protection offices for help. If you have multiple options, try them all and see who’s most responsive. For example, Montgomery County , Md., has a robust consumer protection office, in addition to state resources. In the District, consumer complaints are fielded by the attorney general’s office. Virginia’s attorney general also handles consumer complaints, and some Virginia counties have their own offices as well. These departments are a much better first step than hiring an attorney, because their help is free.

Tap their bond. Contractors’ ads and signage often state “licensed, bonded and insured.” That’s more than just a line; it’s an opportunity. If a bonded contractor abandons your job, damages your property, does shoddy work or fails to pay subcontractors who then come after you for money, take a close look at the contractor’s bond. Chances are these transgressions are covered by it. Contact the company that issued the bond, usually an insurance company, and ask. Be prepared to prove your case.

Go to arbitration. If your contractor is at all slick or sophisticated, he or she may have included a mandatory arbitration clause in your contract. This is not all bad. Arbitration is less expensive than a lawsuit and is often so user-friendly that you won’t need an attorney. A trained arbitrator will listen to both sides and issue a decision. Even if you are not required to go to arbitration, you may want to, because it’s often quick and efficient. The Better Business Bureau is one organization that offers to arbitrate disputes between consumers and businesses for low or no fees.

Take it to court. If all else has failed and you must sue, check to see whether the amount of money you’re seeking falls below the small-claims threshold in your state. For example, in Maryland and Virginia, small-claims cases can be brought for no more than $5,000. D.C. courts allow small-claims cases of up to $10,000. Small-claims court is structured so that citizens can handle the process themselves. Your other legal alternative is to hire an attorney to file a full-fledged civil case. Because lawyers are expensive, this is probably only worth it if yours was a large project and you suffered a significant monetary loss.

Seek government compensation. Many homeowners are unaware that some states collect fees from contractors when they license them, then use that money to reimburse customers whose contractors abandoned a job, defrauded them or performed work not up to code. These funds go by many names, including construction recovery fund, contractor guaranty fund and construction industries fund. Just search these terms and the name of your state to see whether you’re in luck. Unfortunately, the District does not have such a reimbursement program. But Maryland has the Guaranty Fund, and Virginia has the Contractor Transaction Recovery Fund. Some states allow you to apply directly to the fund if a contractor has taken advantage of you; others require you to file and win a lawsuit or to place liens against the contractor’s property first. And caps on awards range from $10,000 to $50,000, depending on the state. Keep in mind that although there may be variations in these reimbursement programs, one thing is the same in every state with such a fund: They award money only to people who were harmed by licensed contractors. Enough said.