Hadithcore
Al-Adab Al-Mufrad, 764
sahih· Al-Albani

Ibn 'Abbas said, "None of you should say about a thing which he does not know, 'Allah knows it' when Allah may know that it is other than what he said and thus he (tries to) teach Allah what he does not know. That is something terrible in Allah's sight."

حَدَّثَنَا عَلِيُّ بْنُ عَبْدِ اللهِ، قَالَ‏:‏ حَدَّثَنَا سُفْيَانُ قَالَ‏:‏ قَالَ عَمْرٌو‏:‏ عَنِ ابْنِ عَبَّاسٍ‏:‏ لاَ يَقُولَنَّ أَحَدُكُمْ لِشَيْءٍ لاَ يَعْلَمُهُ‏:‏ اللَّهُ يَعْلَمُهُ ؛ وَاللَّهُ يَعْلَمُ غَيْرَ ذَلِكَ، فَيُعَلِّمَ اللَّهَ مَا لاَ يَعْلَمُ، فَذَاكَ عِنْدَ اللهِ عَظِيمٌ‏.‏

References2 variants
In-Book Reference
Book 33, Hadith 11
English Reference
Book 33, Hadith 764