Our Gemara on Amud Aleph and Beis tells us of an incident where When Rabbi Abba ascended from Babylonia to Eretz Yisrael, he said: May it be God’s will that I say a statement of halakha that will be accepted by my listeners in Eretz Yisrael, so that I will not be put to shame. In the end, his statements were ridiculed as not being analytically sound.  

The Chasam Sofer says Rabbi Abba’s prayer was not granted, as it was with improper intentions.  That is, he was more concerned about how he would appear than reaching the truth.  

However the Chasam Sofer asks, is this not identical to the prayer that Rabbi Nechunya ben Hakana advises one to say before entering the Study Hall (Berachos 28b)?

תָּנוּ רַבָּנַן: בִּכְנִיסָתוֹ מַהוּ אוֹמֵר? ״יְהִי רָצוֹן מִלְּפָנֶיךָ ה׳ אֱלֹהַי שֶׁלֹּא יֶאֱרַע דְּבַר תַּקָּלָה עַל יָדִי, וְלֹא אֶכָּשֵׁל בְּדָבָר הֲלָכָה, וְיִשְׂמְחוּ בִּי חֲבֵרַי, וְלֹא אוֹמַר עַל טָמֵא טָהוֹר, וְלֹא עַל טָהוֹר טָמֵא. וְלֹא יִכָּשְׁלוּ חֲבֵרַי בִּדְבַר הֲלָכָה, וְאֶשְׂמַח בָּהֶם״.

The Sages taught in a baraita the complete formula of Rabbi Neḥunya ben Hakana’s prayer: Upon his entrance, what does he say? May it be Your will, Lord my God, that no mishap in determining the halakha transpires caused by me, and that I not fail in any matter of halakha, and that my colleagues, who together with me engage in clarifying the halakha, and rejoice in me. He specified: And that I will neither declare pure that which is impure, nor declare impure that which is pure and that my colleagues will not fail in any matter of halakha, and cause mirth.

It appears that in the prayer the person is also asking that he not be ridiculed, so this would seem to legitimize Rav Abba’s prayer!  The Chasam Sofer answers that if you look at Rashi’s commentary on the Gemara in Berachos, he explains that the intention of the prayer is to not err AND CAUSE colleagues to laugh, thereby causing a stumbling block for the colleagues.  It seems that Rashi, with his careful choice of words, was avoiding the contradiction to our Gemara.  Another answer can be found the Bais Yosef ( ב״י א״ח ק״י) who interprets the last clause, “וְיִשְׂמְחוּ בִּי חֲבֵרַי” “and rejoice in me”, as NOT related to the colleagues, but rather to words of Torah. That is to rejoice in the words of Torah.