Whether animals experience human-like emotions is controversial and of immense societal concern [1,2,3]. Because animals cannot provide subjective reports of how they feel, emotional state can only be inferred using physiological, cognitive, and behavioral measures [4,5,6,7,8]. In humans, negative feelings are reliably correlated with pessimistic cognitive biases, defined as the increased expectation of bad outcomes [9,10,11]. Recently, mammals [12,13,14,15,16] and birds [17,18,19,20] with poor welfare have also been found to display pessimistic-like decision making, but cognitive biases have not thus far been explored in invertebrates. Here, we ask whether honeybees display a pessimistic cognitive bias when they are subjected to an anxiety-like state induced by vigorous shaking designed to simulate a predatory attack. We show for the first time that agitated bees are more likely to classify ambiguous stimuli as predicting punishment. Shaken bees also have lower levels of hemolymph dopamine, octopamine, and serotonin. In demonstrating state-dependent modulation of categorization in bees, and thereby a cognitive component of emotion, we show that the bees’ response to a negatively valenced event has more in common with that of vertebrates than previously thought. This finding reinforces the use of cognitive bias as a measure of negative emotional states across species and suggests that honeybees could be regarded as exhibiting emotions.