If the lienor shall fail, for any reason, to establish a valid lien in an action under the provisions of this article, he may recover judgment therein for such sums as are due him, or which he might recover in an action on a contract, against any party to the action.
N.Y. Lien Law § 54