Kitzur Shulchan Aruch, Rabbi Shlomo Ganzfried
Chapter 56 Laws Concerning Berachos Recited Erroneously
If, by mistake, you said the berachah, Borei minei mezonos, over bread, or you said the berachah, Hamotzi, over cake you have fulfilled your duty. But if you said [Hamotzi] over cooked food, even [if it is prepared] from the [five species( of grain, your obligation is not fulfilled. If, by mistake, you said beracha, Borei peri hagafen, over grapes you have fulfilled your duty. Similarly, if in error, you said the after-berachah, Al hagefen, after [eating grapes], you have done your duty, because grapes are also fruit of the vine.
If, by mistake, you said the berachah, Borei peri ha'adamah, over fruit of the tree, or if both [fruits of the tree and of the ground] were before you, and, by mistake, you first said the berachah over the fruit of the ground (Ha'adamah) with the intention of exempting the fruit of the tree, you have fulfilled because the tree also draws its nourishment from the earth. But if you say Borei peri ha'eitz over fruit of the ground, you have not fulfilled your obligation. Consequently, if you are in doubt whether a certain fruit is a fruit of the tree or a fruit of the ground, and it is impossible for you to determine [its nature], then you should recite over it Borei peri ha'adamah.
If, by mistake, you said the berachah, Borei peri ha'eitz, over wine, and you notice [your error] immediately, you should add at once Borei peri hagafen. But if you did not notice [your error] immediately, you have fulfilled your duty, since it is after the fact.
Over any article of food, even over bread or wine, if, by mistake, you recited the berachah Shehakol, you have fulfilled your obligation.
Although, initially, you should ascertain [the natture of the food] over which you are about to say the berachah (as mentioned in Chapter 50:3), nevertheless, if your intention was in error, for example, if you take a cup, thinking that it wine, and you begin the berachah with the understanding that the cup contains wine, but before saying the words Borei peri hagafen, you discover that it holds water or beer, and you conclude with Shehakol ni'yah bidevaaro, you need not repeat the berachah, because, for mistaken intention, you do not need to to repeat the berachah. Even more so, if your error would be reversed, in that you have the mistaken impression that [the cup] contains beer or water, and you begin the berachah with the intention of ending it with Shehakol, but before saying Shehakol, you discover [that the cup] holds wine and you conclude with Borei peri hagafen, you have fulfilled your obligation. After all, even if you had concluded the berachah as you originally intended, you would have fulfilled your duty.
Even if you completed the entire berachah erroneously, but you became aware [of your mistake] at once and you corrected the recitation; for example, if you took a glass of water or beer, and, thinking that it is wine, you said the berachah, Borei pen hagafen and you discovered immediately that it was water or beer, and you concluded [by saying the words] Shehakol ni'yah bidevaro, you said in fact: Borei pen hagafen—shehakol ni'yah bidevaro—you have fulfilled your obligation.
If you were not immediately aware [of your error], you must recite the entire berachah, Shehakol, anew if you wish to drink this glass [of water]. If you intended to drink wine afterward, you may take some wine and drink it at once, without saying a second berachah, as long as you did not interrupt by speaking (see Chapter 50:4, 5 above). [This rule applies] even though you tasted [the contents of] the glass and by tasting it, you discovered that it contains water or beer, nevertheless, [tasting] is not considered an interruption, since it is a fait accompli ("an accomplished fact") — it is already done. (Regarding kiddush see Ch. 77:12 below)