Scholars have emphasized the potential of self-regulation, realized through 'codes of good governance', to improve gender diversity on boards. Yet, unconvinced of the effectiveness of this self-regulation, many regulators have implemented mandatory quota laws. Our study sheds light on this dilemma. Seeking to broaden our conceptual knowledge of how such 'codes' work in the specific case of gender diversity on boards, we ask: Under which conditions is self-regulation via voluntary principles of good governance effective? Expanding recent institutional-theory perspectives from the literature of women on boards, we show that, in the case of Austria, self-regulation via code recommendations is ineffective unless supported by additional forces. The primary reason for this, we argue, is that nominators do not expect benefits from gender-diverse boards. Furthermore, non-compliant companies face little pressure to change due to the small number of companies that have already adopted respective code recommendations. We identify two potential alternatives to boost the effectiveness of voluntary self-regulation for gender-diverse boards: First, the introduction of concrete targets for female representation and the public monitoring of fulfillment; and, second, the establishment of a credible threat that mandatory quotas will be imposed if diversity goals are not achieved. Drawing on longitudinal data from 2006 to 2016 on listed and state-owned companies in Austria, we give an empirical account of the conditions that assure effective self-regulation. Arguing that codes suffer from what we call 'opportunity bias', we conclude that political goals (such as gender equality) based on ethical rather than instrumental considerations are unlikely to be effectively implemented solely by codes of good governance.