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:21:87

And ˹mention˺ the man of the fish, when he went off in anger and thought that We would not decree ˹anything˺ upon him. And he called out within the darknesses, "There is no deity except You; exalted are You. Indeed, I have been of the wrongdoers."  

And, mention, Dhū’l-Nūn, the one of the whale, namely, Jonah son of Amittai (Yūnus bin Mattā) when he went off enraged (˹Dhā’l-Nūn˺ is substituted by ˹the clause idh dhahaba mughādiban˺) by his people, that is, furious with them because of what he had suffered at their hands — even though he had not been granted permission ˹by God to go off as he did˺ — thinking that We had no power over him, that is, that We could ˹not˺ compel him to ˹submit to˺ Our decree in the way that We did by imprisoning him inside the stomach of the whale; or that We could ˹not˺ make circumstances difficult for him. Then he cried out in the darknesses, ˹through˺ the darkness of the night, the darkness of the sea and the darkness of the whale’s stomach, that: ‘There is no god except You! Glory be to You! I have indeed been one of the wrongdoers’, for leaving my people without ˹Your˺ permission.
القرآن:٢١:٨٧

وَذَا النُّونِ إِذْ ذَهَبَ مُغَاضِبًا فَظَنَّ أَنْ لَنْ نَقْدِرَ عَلَيْهِ فَنَادَىٰ فِي الظُّلُمَاتِ أَنْ لَا إِلَٰهَ إِلَّا أَنْتَ سُبْحَانَكَ إِنِّي كُنْتُ مِنَ الظَّالِمِينَ  

{و} اذكر {ذا النون} صاحب الحوت وهو يونس بن متى ويبدل منه {إذ ذهب مغاضباً} لقومه أي غضبان عليهم مما قاسى منهم ولم يؤذن له في ذلك {فظن أن لن نقدر عليه} أي نقضي عليه بما قضيناه من حبسه في بطن الحوت، أو نضيق عليه بذلك {فنادى في الظلمات} ظلمة الليل وظلمة البحر وظلمة بطن الحوت {أن} أي بأن {لا إله إلا أنت سبحانك إني كنت من الظالمين} في ذهابي من بين قومي بلا إذن.