Errors indicate the need to adjust attention for improved future performance. Detecting errors is thus a fundamental step to adjust and control attention. These functions have been associated with the dorsal anterior cingulate cortex (dACC), predicting that dACC cells should track the specific processing states giving rise to errors in order to identify which processing aspects need readjustment. Here, we tested this prediction by recording cells in the dACC and lateral prefrontal cortex (latPFC) of macaques performing an attention task that dissociated 3 processing stages. We found that, across prefrontal subareas, the dACC contained the largest cell populations encoding errors indicating (1) failures of inhibitory control of the attentional focus, (2) failures to prevent bottom-up distraction, and (3) lapses when implementing a choice. Error-locked firing in the dACC showed the earliest latencies across the PFC, emerged earlier than reward omission signals, and involved a significant proportion of putative inhibitory interneurons. Moreover, early onset error-locked response enhancement in the dACC was followed by transient prefrontal-cingulate inhibition, possibly reflecting active disengagement from task processing. These results suggest a functional specialization of the dACC to track and identify the actual processes that give rise to erroneous task outcomes, emphasizing its role to control attentional performance.