Phytophagous insects have several defence strategies to defend themselves against attack by parasitic wasps. Larval lepidopteran hosts can defend themselves actively to prevent oviposition by the parasitoid. Among the aggressive kinds of behaviour exhibited by hosts against parasitoids are violent wriggling, biting and spitting. The behaviour of the braconid parasitoid Cotesia sesamiae attacking stemboring larvae inside their feeding tunnel in the plant stem was investigated in maize and sugarcane stem pieces and transparent artificial tunnels. Attacking a defending stemborer host inside the confined space of a tunnel was shown to be risky for the female parasitoid. A considerable proportion (25%) of female wasps were killed in their attempt to attack the spitting and biting host. No difference was found in the behaviour of C. sesamiae attacking the suitable host Sesamia calamistis or the unsuitable host Eldana saccharina. The consequences of this high mortality risk involved in each host attack is discussed in relation to the ecology of the parasitoid.