We demonstrate the use of dynamic longitudinal models to investigate error management in cardiac surgery. Case study data were collected from a multicentre study of the neonatal arterial switch operation (ASO). Information on two types of negative events, or 'errors', observed during surgery, major and minor events, was extracted from case studies. Each event was judged to be recovered from (compensated) or not (uncompensated). The aim of the study was to model compensation given the occurrence of past events within a case. Two models were developed, one for the probability of compensating for a major event and a second model for the probability of compensating for a minor event. Analyses based on dynamic logistic regression models suggest that the total number of preceding minor events, irrespective of compensation status, is negatively related with the ability to compensate for major events. The alternative use of random effects models is investigated for comparison purposes.