The Messenger of Allah ﷺ said, "Do not sell fruit until its ripeness becomes apparent." He forbade both the seller and the buyer.
حدثنا محمد بن رمح أنبأنا الليث بن سعد عن نافع
عن رسول الله ﷺ قال لا تبيعوا الثمرة حتى يبدو صلاحها نهى البائع والمشتري
[Its isnad is sahih]. Nasai narrated it: 7/262, Sales - selling fruit before its ripeness becomes apparent, no. 4523, from the hadith of Layth, with this wording. It has other routes in Bukhari and Muslim and others, from Nafi, from Ibn Umar, with a similar meaning.