In matching models, pairwise stable outcomes do not generally exist without substantial restrictions on both preferences and the topology of the network of contracts.
We address the foundations of matching markets by developing a matching model with a continuum of agents that allows for complex preferences and network structures. We argue
that tree stability, a refinement of pairwise stability, is the natural solution concept for this setting. Our main results show tree-stable outcomes exist for arbitrary preferences and
network topologies, and provide a noncooperative microfoundation for tree stability. Our framework can flexibly capture the extent to which agents can coordinate.