Bacterial cells are encased in peptidoglycan (PG), a polymer of disaccharide N-acetylglucosamine (GlcNAc) and N-acetyl-muramic acid (MurNAc) cross-linked by peptide stems. PG is synthesized in the cytoplasm as UDP-MurNAc-peptide precursors, of which the amino acid composition of the peptide is unique, with L-Ala added at the first position in most bacteria but with L-Ser or Gly in some bacteria. YfiH is a PG-editing factor whose absence causes misincorporation of L-Ser instead of L-Ala into peptide stems, but its mechanistic function is unknown. Here, we report the crystal structures of substrate-bound and product-bound YfiH, showing that YfiH is a cytoplasmic amidase that controls the incorporation of the correct amino acid to the nucleotide precursors by preferentially cleaving the nucleotide precursor by-product UDP-MurNAc-L-Ser. This work reveals an editing mechanism in the cytoplasmic steps of peptidoglycan biosynthesis. IMPORTANCE YfiH is a peptidoglycan (PG)-editing factor required for the maintenance of specific amino acid compositions of the stem peptides. However, the activity of YfiH has not been deciphered, and the editing mechanism involving YfiH has remained a mystery. Through X-ray crystallographic and biochemical analyses, we demonstrate that YfiH is a hydrolase with a previously unknown activity specific for the UDP-MurNAc-monopeptide, one of the nucleotide precursors from the cytoplasmic steps of the PG biosynthesis pathway. YfiH selectively hydrolyzes UDP-MurNAc-Ser, an incorrect by-product of the biosynthesis reaction, to ensure that only the correct PG precursor, UDP-MurNAc-Ala, is incorporated. Therefore, this work reveals coupled synthetic and editing reactions in the cytoplasmic steps of PG biosynthesis.