The cocoon is produced over about half an hour from mucus glands in the gill cavity and forms a loose, transparent bag around the fish, usually open at both ends to allow water flow. The fish rests inside it in a reef crevice and abandons the envelope at dawn.
The long-standing suggestion was that it masks scent from nocturnal predators such as moray eels, which hunt largely by smell. A field experiment on Great Barrier Reef parrotfish tested a different function: fish sleeping without a cocoon were attacked far more often by gnathiid isopods, tiny parasitic crustaceans that feed on fish blood at night. The cocoon acted as a physical barrier, and the effect was substantial.
The scent-masking idea has not been ruled out and the two functions are not exclusive. The parasite result is the better-evidenced one. The cost is real: producing the mucus is estimated to consume a noticeable fraction of the fish's daily energy budget, which is a strong argument that the behaviour buys something worth having.
