I was facing this error when trying to force push on my protected branch. Resolved it by enabling Allow force push flag under Repository Settings / Branch rules / Details
Repository Settings / Branch rules / Details