Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:12:87

O my sons, go and find out about Joseph and his brother and despair not of relief from Allah. Indeed, no one despairs of relief from Allah except the disbelieving people."  

O my sons, go and enquire about Joseph and his brother, seek news of them, and do not despair of God’s ˹gracious˺ Spirit, His mercy. Indeed none despairs of the ˹gracious˺ Spirit of God save the disbelieving folk’: and so they departed to Egypt ˹to look˺ for Joseph.
القرآن:١٢:٨٧

يَا بَنِيَّ اذْهَبُوا فَتَحَسَّسُوا مِنْ يُوسُفَ وَأَخِيهِ وَلَا تَيْأَسُوا مِنْ رَوْحِ اللَّهِ ۖ إِنَّهُ لَا يَيْأَسُ مِنْ رَوْحِ اللَّهِ إِلَّا الْقَوْمُ الْكَافِرُونَ  

{يا بني اذهبوا فتحسسوا من يوسف وأخيه} اطلبوا خبرهما {ولا تيأسوا} تقنطوا {من روح الله} رحمته {إنه لا ييأس من روح الله إلا القوم الكافرون} فانطلقوا نحو مصر ليوسف.