Check out this post from u/catopinions
Follow-up question: Andorra is not an isolated event. The [Couto Misto](https://en.wikipedia.org/wiki/Couto_Misto?wprov=sfti1 https://maps.apple.com/?ll=41.908686,-7.833133&q=Couto%20Misto&_ext=EiQpUPTb0E/0REAxIFXPySBVH8A5UPTb0E/0REBBIFXPySBVH8A%3D) was an independent microstate stuck between Portugal and Spain until 1862.
What was fundamentally different about Andorra that led it to endure while Couto Misto was absorbed by Spain and Portugal?
Edit: I mean, the population account alone probably explains it... just read Couto Misto peaked at 1,000 inhabitants by the looks of it.
Semi-related question: how did Monaco survive?
Ha my highschool spanish teacher was from there