A bstract Previous studies have established the involvement of prefrontal cortex (PFC) neurons in decision processes in many task contexts. Single neurons and populations of neurons have been found to represent stimuli, actions, and internal deliberations. However, it is much less clear which underlying computations are affected during errors. Neural activity during errors can help to disambiguate confounds and clarify which computations are essential during a specific task. Here, we used a hidden Markov model (HMM) to perform a trial-by-trial analysis of ensembles of simultaneously recorded neurons from the dorsolateral prefrontal (PFdl) cortex of two rhesus monkeys performing a distance discrimination task. The HMM segments the neural activity into sequences of metastable states, allowing to link neural ensemble dynamics with task and behavioral features in the absence of external triggers. We report a precise relationship between the modulation of the metastable dynamics and task features. Specifically, we found that errors were made more often when the metastable dynamics slowed down, while trial difficulty influenced the latency of state transitions at a pivotal point during the trial. Both these phenomena occurred during the decision interval and not following the action, with errors occurring in both easy and difficult trials. Thus, modulations of metastable dynamics reflected a state of internal deliberation rather than actions taken or, in the case of error trials, objective trial difficulty. Our results show that temporal modulations of PFdl activity are key determinants of internal deliberations, providing further support for the emerging role of metastable cortical dynamics in mediating complex cognitive functions and behavior.