A robot swarm executing a formation task is examined for the presence of anomalies in the robots’ motion behavior using a data-driven contextual anomaly-detection method. The detection of anomalies is particularly relevant for the employed graph-based formation control approach, as the motions of robots influence the behavior of other formation members. With the swarm using a graph-based formation control approach, robots are categorized as normal or anomalous based on an evaluation of the likelihoods of the motions performed by a robot. These likelihoods are estimated by a neural network that was trained on simulated data of normal robot behavior, and anomalous behavior is considered to be a deviation from these learned, normal robot motions. Consequently, the detection method is not restricted to known instances of anomalous behavior and can be tuned to an acceptable maximum false-positive rate on normal robot behavior. With the goal of evaluating the performance of the anomaly-detection method, three different types of anomalous behaviors are designed, and a test dataset is created by simulating the execution of different formation tasks in the presence of one anomalously behaving robot. During the evaluation, the anomalous behavior is correctly detected for more than 80% of the motions performed by the robots. An additional, fourth motion anomaly was simulated and investigated to determine the limits and robustness of the method’s applicability when considering an extrapolation of the method to out-of-context formation scenarios.