Cap4000...if the inspection is done by a municipal inspector, they generally have sovereign immunity from lawsuits, so no big shakes for them to be right or wrong. As woodman88 noted, they usually have few if any credentials. If the inspection was done through a private party, authorized by the municipality to do so, they are usually not indemnified by the municipality and can be held liable...all questions and deliberation for an attorney.
Residential construction codes are more "forgiving" than commercial codes, so part of the blame goes there. If an architect or engineer was required to submit the plans, then the contractor is obligated (under the IRC/IBC and state codes derived from them) to follow the submitted and approved plans or the permit is invalid.
Another issue is that CGL does not usually cover a contractor's screw ups or bad construction...only the consequential damage of such. As an example, if subcontractor A screws up and it damages subcontractor B's work, then a claim can be made for the work damaged by A, but not A's work. To further bring this one home, suppose Sub A is a stucco installer and Sub B is a framing installer. Sub A fails to install the stucco correctly and it causes water intrusion damage to Sub B's work. The damage to the framing would probably be covered under Sub A's CGL; however, the defective stucco work would not be covered. An argument would then have to be made that the only way to repair Sub B's damaged work is to removed Sub A's work, defective or not. It gets complicated with insurance coverage.