There is a famine in the land of Canaan, Yitzchak is thinking of going down to Egypt, as his father Avraham did in his time. God appears to him and says
וַיֵּרָ֤א אֵלָיו֙ ה' וַיֹּ֖אמֶר אַל תֵּרֵ֣ד מִצְרָ֑יְמָה שְׁכֹ֣ן בָּאָ֔רֶץ אֲשֶׁ֖ר אֹמַ֥ר אֵלֶֽיךָ. גּ֚וּר בָּאָ֣רֶץ הַזֹּ֔את וְאֶֽהְיֶ֥ה עִמְּךָ֖ וַֽאֲבָֽרֲכֶ֑ךָּ כִּֽי לְךָ֣ וּֽלְזַרְעֲךָ֗ אֶתֵּן֙ אֶת כָּל הָֽאֲרָצֹ֣ת הָאֵ֔ל וַֽהֲקִֽמֹתִי֙ אֶת הַשְּׁבֻעָ֔ה אֲשֶׁ֥ר נִשְׁבַּ֖עְתִּי לְאַבְרָהָ֥ם אָבִֽיךָ.
And the Lord appeared to him, and said, "Do not go down to Egypt; dwell in the land that I will tell you. Sojourn in this land, and I will be with you, and I will bless you, for to you and to your seed will I give all these lands, and I will establish the oath that I swore to Abraham, your father.
As Rashi explains
For he had in mind to go down to Egypt as his father had gone down in the days of the famine. He [God] said to him, “Do not go down to Egypt.” You are a perfect burnt offering, and being outside the Holy Land is not fitting for you.