Suppose that one kingdom in medieval times got attacked by an amphibious invasion from the Ottomans, despite not being an obvious target and in fact is waaaay out of the Ottomans' way for their navy (as in farther than the Spanish armada went on their planned path to England).
There is a crisis between the monarch who tried to centralize power and the nobles who don't. This erupted into a civil war which ended in concessions from the king,
The kingdom then faces three generalized revolts by peasants in three decades, at one point having 1/8 of the abled bodied males involved in the revolts.
All this time, the shipping industry starts to decline as outside factors cause sea trade to drop.
The monarch dies, leaving the way for a child king, who dies to a disease tree years later. According to the codified succession laws, males are chosen, but a son-less dynast has his/her oldest daughter take his position if s/he is dead too (what we call nowadays male preference primogeniture). The child king has no siblings. The previous king had no otherchildren. The previous king's mother was queen and all her lines are extinct too. Her father was king and he has no living descendants either. His father was king and does have many descendants through three other lines.
And the senior line points to... the archduchess consort of Austria, or consort of the Holy Roman Empire.
Assuming that the nobles don't have any anti-HRE sentiment, what is their reaction? Is it "oh shit"? I mean that's what the English had (at first when) they realized James VI of Scotland was King James I of England.