كتاب الإيمان
1  
The Book of Faith
(57)
Chapter: Clarification that Allah, most high allows a person's thoughts and whatever occurs in his heart, so long as they do not become established, and the clarification that he, glorious is he and most high, does not burden anyone with more than he can bear, and clarifying the ruling on thinking of doing good and bad deeds
(57)
باب بَيَانِ أَنَّهُ سُبْحَانَهُ وَتَعَالَى لَمْ يُكَلِّفْ إِلَّا مَا يُطَاقُ
Sahih Muslim 126

It is narrated on the authority of Ibn 'Abbas:

When this verse:" Whether you disclose that which is in your mind or conceal it, Allah will call you to account according to it" (ii 284), there entered in their minds something (of that fear) such as had never entered their hearts (before). The Apostle (ﷺ) observed: Say: We have heard and obeyed and submitted ourselves. He (the reporter) said: Allah instilled faith in their hearts and He revealed this verse:" Allah burdens not a soul beyond its capacity. It gets every good that it earns and it suffers every ill that it earns. Our Lord, call us not to account if we forget or make a mistake. He the (Lord) said: I indeed did it. Our Lord! do not lay on us a burden as Thou didst lay on those before us. He (our Lord) said: I indeed did it. And pardon us, have mercy on us. Thou art our Protector" (ii. 286). He said: I indeed did it.
حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، وَأَبُو كُرَيْبٍ وَإِسْحَاقُ بْنُ إِبْرَاهِيمَ - وَاللَّفْظُ لأَبِي بَكْرٍ قَالَ إِسْحَاقُ أَخْبَرَنَا وَقَالَ الآخَرَانِ، حَدَّثَنَا - وَكِيعٌ، عَنْ سُفْيَانَ، عَنْ آدَمَ بْنِ سُلَيْمَانَ، مَوْلَى خَالِدٍ قَالَ سَمِعْتُ سَعِيدَ بْنَ جُبَيْرٍ، يُحَدِّثُ عَنِ ابْنِ عَبَّاسٍ، قَالَ لَمَّا نَزَلَتْ هَذِهِ الآيَةُ ‏{‏ وَإِنْ تُبْدُوا مَا فِي أَنْفُسِكُمْ أَوْ تُخْفُوهُ يُحَاسِبْكُمْ بِهِ اللَّهُ‏}‏ قَالَ دَخَلَ قُلُوبَهُمْ مِنْهَا شَىْءٌ لَمْ يَدْخُلْ قُلُوبَهُمْ مِنْ شَىْءٍ فَقَالَ النَّبِيُّ صلى الله عليه وسلم ‏"‏ قُولُوا سَمِعْنَا وَأَطَعْنَا وَسَلَّمْنَا ‏"‏ ‏.‏ قَالَ فَأَلْقَى اللَّهُ الإِيمَانَ فِي قُلُوبِهِمْ فَأَنْزَلَ اللَّهُ تَعَالَى ‏{‏ لاَ يُكَلِّفُ اللَّهُ نَفْسًا إِلاَّ وُسْعَهَا لَهَا مَا كَسَبَتْ وَعَلَيْهَا مَا اكْتَسَبَتْ رَبَّنَا لاَ تُؤَاخِذْنَا إِنْ نَسِينَا أَوْ أَخْطَأْنَا‏}‏ قَالَ قَدْ فَعَلْتُ ‏{‏ رَبَّنَا وَلاَ تَحْمِلْ عَلَيْنَا إِصْرًا كَمَا حَمَلْتَهُ عَلَى الَّذِينَ مِنْ قَبْلِنَا‏}‏ - قَالَ قَدْ فَعَلْتُ ‏{‏ وَاغْفِرْ لَنَا وَارْحَمْنَا أَنْتَ مَوْلاَنَا‏}‏ قَالَ قَدْ فَعَلْتُ ‏.‏
Reference : Sahih Muslim 126
In-book reference : Book 1, Hadith 237
USC-MSA web (English) reference : Book 1, Hadith 229
  (deprecated numbering scheme)