Nonconsumptive effects of predators can have knock-on effects on prey fitness, life history and population dynamics. However, the origin of cues stimulating predator avoidance behaviour and the mechanisms underlying prey responses need further investigation. Previous studies revealed that nonconsumptive effects of predatory fish on Baetis mayfly larvae are mediated by water-borne chemical cues released from fish mucus. However, there are conflicting results regarding the nature of these cues and the specific role of the activity of fish mucus-dwelling bacteria in stimulating predator avoidance by prey. To address those conflicting results, we investigated whether bacteria dwelling in fish mucus and/or chemical components present in fish mucus are responsible for the predator avoidance response by Baetis mayflies to salmonids. Results of five bioassays conducted in microcosms revealed that to stimulate Baetis predator avoidance behaviour: (1) bacteria do not need to be present in salmonid mucus; (2) the saccharide fraction of the fish mucus glycosaminoglycan component, but neither the protein fraction nor the whole molecule, functions as a kairomone; (3) specific active components of the saccharide fraction are primarily amino sugars in the form of hexosamines; and (4) there is a minimum dose of mucus and specifically of hexosamine needed. Our study provides the first experimental evidence that mayfly larvae recognize fish predators via the amino sugars naturally present in fish skin mucus. These sugars are released into the water by microbially mediated breakdown of glycosaminoglycans. Further research on the responses of different invertebrate prey species to similar predator cues are needed to understand the evolutionary history of this kairomone recognition behaviour.