Whenever you try to sell a share of a given instrument, you might get a message saying "You have to buy this equity before you sell it".
This message can appear if you already have a Pending Sell or Sell (Market) Order on the position you want to close. In this case, to execute your current sell order, you would have to cancel all pending and previous orders.