If you’re trying to sell a stock which is in T,XT or ST category (trade to trade) without it being credited to your demat account (i.e T1 Holdings), you will get the same error.
In such cases you will have to wait for the stock to come into your holdings which takes T+2 days.