Emit an error on invalid secret, cleanup