Given the enormous value that project failure brings to individuals and organizations, a large number of scholars have explored the antecedents that affect employees’ learning from project failure. However, few scholars have paid attention to how individuals’ affective states interact with cognition patterns to learn from failure. Based on cognitive behavioral theory, this paper explores the relationship between employees’ different daily affective states and learning from project failure and incorporates the mediating role of error management strategy and the moderating role of project commitment. By using SPSS and Amos software, hierarchical regression analysis of questionnaire data collected from 774 employees in high-tech firms in China indicates that (1) positive/negative affective states positively/negatively affect learning from failure, respectively; (2) error management strategy mediates the relationship between daily affective states and learning from project failure; and (3) project commitment moderates the relationship between negative affective states and error management strategy; specifically, this relationship is weaker when project commitment is stronger. However, the moderating effect of project commitment on the relationship between positive affective states and error management strategy is not supported. The results further expand the research related to learning from failure and have practical implications for failure management in high-tech enterprises.