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:81:29

And you do not will except that Allah wills - Lord of the worlds.  

but you will not ˹wish˺, to go straight along the ˹path of˺ truth, unless God, the Lord of the Worlds, ˹of all˺ creatures, wills, that you should go straight along it. Meccan, consisting of 19 verses.
القرآن:٨١:٢٩

وَمَا تَشَاءُونَ إِلَّا أَنْ يَشَاءَ اللَّهُ رَبُّ الْعَالَمِينَ  

{وما تشاءون} الاستقامة على حق {إلا أن يشاء الله رب العالمين} الخلائق استقامتكم عليه.

See similar narrations below:

Collected by Qurʾān
quran:76:30

And you do not will except that Allah wills. Indeed, Allah is ever Knowing and Wise.  

But you will not (tashā’ūna, may also be read yashā’ūna, ‘they will’), choose a way through obedience, unless God wills, this. Assuredly God is ever Knower, of His creatures, Wise, in what He does.
القرآن:٧٦:٣٠

وَمَا تَشَاءُونَ إِلَّا أَنْ يَشَاءَ اللَّهُ ۚ إِنَّ اللَّهَ كَانَ عَلِيمًا حَكِيمًا  

{وما تشاءون} بالتاء والياء اتخاذ السبيل بالطاعة {إلا أن يشاء الله} ذلك {إن الله كان عليما} بخلقه {حكيما} في فعله.