Immunity doctrines aren’t designed to protect against (and they aren’t necessary to protect against) meritless claims. Instead, they protect against *meritorious* claims, which is their main function. Immunity doctrines ensure that government officials can’t be sued even when they violate the law.