(ב) כִּי יָקוּם בְּקִרְבְּךָ נָבִיא אוֹ חֹלֵם חֲלוֹם וְנָתַן אֵלֶיךָ אוֹת אוֹ מוֹפֵת. (ג) וּבָא הָאוֹת וְהַמּוֹפֵת אֲשֶׁר דִּבֶּר אֵלֶיךָ לֵאמֹר נֵלְכָה אַחֲרֵי אֱלֹהִים אֲחֵרִים אֲשֶׁר לֹא יְדַעְתָּם וְנָעָבְדֵם. (ד) לֹא תִשְׁמַע אֶל דִּבְרֵי הַנָּבִיא הַהוּא אוֹ אֶל חוֹלֵם הַחֲלוֹם הַהוּא כִּי מְנַסֶּה יְהוָה אֱלֹהֵיכֶם אֶתְכֶם לָדַעַת הֲיִשְׁכֶם אֹהֲבִים אֶת יְהוָה אֱלֹהֵיכֶם בְּכָל לְבַבְכֶם וּבְכָל נַפְשְׁכֶם.
(יט) וַיֹּאמְר֖וּ אִ֣ישׁ אֶל־אָחִ֑יו הִנֵּ֗ה בַּ֛עַל הַחֲלֹמ֥וֹת הַלָּזֶ֖ה בָּֽא׃
רמב"ם הלכות עבודה זרה 9:4
כנענים עובדי כו"ם הם ויום ראשון הוא יום אידם לפיכך אסור לתת ולשאת עמהם בארץ ישראל יום חמישי ויום ששי שבכל שבת ושבת ואין צריך לומר יום ראשון עצמו שהוא אסור בכ"מ וכן נוהגין עמהם בכל אידיהם:
Maimonides, Laws of Idol Worship 9:4
The Christians are idol worshipers and Sunday is their religious holiday, therefore in Eretz Israel we may not trade with them on Thursday and Friday of every week, and needless to say on Sunday, which is forbidden [for trade with Christians] everywhere.”
(ו) וְהַנָּבִיא הַהוּא אוֹ חֹלֵם הַחֲלוֹם הַהוּא יוּמָת כִּי דִבֶּר סָרָה עַל יְהוָה אֱלֹהֵיכֶם הַמּוֹצִיא אֶתְכֶם מֵאֶרֶץ מִצְרַיִם וְהַפֹּדְךָ מִבֵּית עֲבָדִים לְהַדִּיחֲךָ מִן הַדֶּרֶךְ אֲשֶׁר צִוְּךָ יְהוָה אֱלֹהֶיךָ לָלֶכֶת בָּהּ וּבִעַרְתָּ הָרָע מִקִּרְבֶּךָ.
(כא) וַיִּשְׁמַ֣ע רְאוּבֵ֔ן וַיַּצִּלֵ֖הוּ מִיָּדָ֑ם וַיֹּ֕אמֶר לֹ֥א נַכֶּ֖נּוּ נָֽפֶשׁ׃ (כב) וַיֹּ֨אמֶר אֲלֵהֶ֣ם׀ רְאוּבֵן֮ אַל־תִּשְׁפְּכוּ־דָם֒ הַשְׁלִ֣יכוּ אֹת֗וֹ אֶל־הַבּ֤וֹר הַזֶּה֙ אֲשֶׁ֣ר בַּמִּדְבָּ֔ר וְיָ֖ד אַל־תִּשְׁלְחוּ־ב֑וֹ לְמַ֗עַן הַצִּ֤יל אֹתוֹ֙ מִיָּדָ֔ם לַהֲשִׁיב֖וֹ אֶל־אָבִֽיו׃ (כט) וַיָּ֤שָׁב רְאוּבֵן֙ אֶל־הַבּ֔וֹר וְהִנֵּ֥ה אֵין־יוֹסֵ֖ף בַּבּ֑וֹר וַיִּקְרַ֖ע אֶת־בְּגָדָֽיו׃
(21) And Reuben heard it, and delivered him out of their hand; and said: ‘Let us not take his life.’ (22) And Reuben said unto them: ‘Shed no blood; cast him into this pit that is in the wilderness, but lay no hand upon him’—that he might deliver him out of their hand, to restore him to his father. (29) And Reuben returned unto the pit; and, behold, Joseph was not in the pit; and he rent his clothes.
I would like to propose that since Yosef did this false dreaming scene without intention of avodah zarah, the punishment was administered halfway: חֹלֵם הַחֲלוֹם הַהוּא יוּמָת ,that he should die, was left unfulfilled; however, וּבִעַרְתָּ הָרָע מִקִּרְבֶּךָ ,that he should be removed from Bnai Yisrael, was administered.
(כו) וַיֹּ֥אמֶר יְהוּדָ֖ה אֶל־אֶחָ֑יו מַה־בֶּ֗צַע כִּ֤י נַהֲרֹג֙ אֶת־אָחִ֔ינוּ וְכִסִּ֖ינוּ אֶת־דָּמֽוֹ׃ (כז) לְכ֞וּ וְנִמְכְּרֶ֣נּוּ לַיִּשְׁמְעֵאלִ֗ים וְיָדֵ֙נוּ֙ אַל־תְּהִי־ב֔וֹ כִּֽי־אָחִ֥ינוּ בְשָׂרֵ֖נוּ ה֑וּא וַֽיִּשְׁמְע֖וּ אֶחָֽיו׃
(26) And Judah said unto his brethren: ‘What profit is it if we slay our brother and conceal his blood? (27) Come, and let us sell him to the Ishmaelites, and let not our hand be upon him; for he is our brother, our flesh.’ And his brethren hearkened unto him.
לפי שרדף אליפז בן עשו במצות אביו אחריו להורגו והשיגו ולפי שגדל אליפז בחיקו של יצחק משך ידו א"ל מה אעשה לציווי של אבא אמר לו יעקב טול מה שבידי והעני חשוב כמת
...Because Elifaz the son of Esav chased him on his father's command to kill him, but because they both grew up in Yitzchak's bosom, he pulled back his hand and said, "What should I do about the command of my father?" Yaakov said to him, "Take what is in my hand, since the poor person is thought of as dead."