BackgroundThe gut microbiota of black soldier fly larvae (BSFL, Hermetia illucens) play a crucial role in recycling various organic waste streams. This capability is linked to the presence of a potential common core microbiota in BSFL. However, subjective thresholds for defining core taxa and the difficulty of separating genetic and environmental influences have prevented a clear consensus in the literature. We analysed the gut bacterial communities of two genetically distinct BSF lines (wild type (WT) and lab-adapted line (LD)) raised on ten different diets based on common agricultural by-products and food waste in Southeast Asia.ResultsHigh-throughput 16S rRNA gene sequencing revealed that gut bacterial communities were significantly influenced by genetics (p = 0.001), diet (plant/meat-dominated; p = 0.001), larval age (p = 0.001), and the interactions between all three (p = 0.002). This led us to investigate both common core taxa and lineage-specific core taxa. At a strict > 97% prevalence threshold, four core taxa were identified: Providencia_A_732258, an unclassified genus within the family Enterococcaceae, Morganella, and Enterococcus_H_360604. A relaxed threshold (> 80% prevalence) extended the core to include other potential common core taxa such as Klebsiella, Proteus, and Scrofimicrobium. Our data suggest that Proteus, Scrofimicrobium, Corynebacterium, Vagococcus_B, Lysinibacillus_304693 (all LD), and Paenibacillus_J_366884 (WT) are lineage-specific rather than members of a common core (> 90% prevalence in either LD or WT, with prevalence significantly different between lines (p ≤ 0.05)). Positive correlations were observed between several core genera and larval performance in LD, typical of a highly optimized lab-adapted line. Interestingly, only members of the genus Providencia appeared to play a crucial role in most aspects of larval performance in both genetic lineages.ConclusionOur study demonstrates that the gut microbiota of BSFL is influenced by genetic factors, diet composition, larval age, and their interactions. We identified a distinct lineage-specific core microbiota, emphasizing genetic background’s role. Future studies should apply a standardized high prevalence threshold of at least > 90% unless there is a valid reason for relaxation or sample exclusion. The consistent association of Providencia spp. with larval performance across both genetic lines highlights their crucial role in the BSFL gut ecosystem.