foxA orthologs are involved in various processes from embryo patterning to regulation of metabolism. Since foxA conserved role in the development of the gut of errant annelids has never been thoroughly studied, we used a candidate gene approach to unravel the molecular profile of the alimentary canal in two closely related nereid worms with a trochophore-type lecithotrophic larva. The character of foxA expression in the two polychaetes was similar but not identical. The genes were successively activated first in blastoporal cells, then in the stomodeum, the midgut, and hindgut primordia, and in the cells of central and peripheral nervous system. Before the start of active feeding of nectochaetes, we observed a short phase of foxA expression in the entire digestive tract. After amputation of posterior segments, foxA expression was established de novo in the new terminal part of the intestine, and then in the developing hindgut and the anus. We discovered an early marker of endoderm formation previously unknown in errant annelids. Its expression dynamics provided valuable insights into the gut development. Comparative analysis of foxA activity suggests its primary role in gastrulation morphogenesis independently of its type and in midgut and foregut specification. Developmental Dynamics 248:728-743, 2019. © 2018 Wiley Periodicals, Inc.