Many scholars have suggested that Western societies are becoming more polarized, and it has been argued that such conflict is identity-based, rather than based in ideological differences. Even though the literature on "affective polarization" is growing rapidly, few studies focus on analyzing the consequences of such identity-based conflict at the elite level. This paper aims to fill this gap, focusing specifically on the consequences of elite affective polarization on government formation. Based on an assumption that identity-based conflict makes it difficult for political opponents to reach policy compromises that are necessary for the formation of coalition governments. Consequently, we hypothesize that affective polarization between political parties will make it less likely for these parties to form a government. We also expect that any potential government including parties that are "shunned" by most parties in the system are less likely to form. We evaluate these hypotheses drawing on unique survey data collected among council members in the 290 Swedish municipalities, making use of "like-dislike" scores gauging the level of affective polarization. Since the survey also include questions about left-right positions of parties, we can control for ideological distances between political parties, allowing us to isolate the impact of identity-based conflict. Our results show support for our hypotheses, which suggests that identity-based conflict make coalition formation more complicated and may threaten parliamentary democracy by creating problems of "gridlock" at the government formation stage.