Millimeter-wave communications rely on narrow-beam transmissions to cope with the strong signal attenuation at these frequencies, thus demanding precise alignment between transmitter and receiver. However, the beam-alignment procedure may entail a huge overhead and its performance may be degraded by detection errors. This paper proposes a coded energy-efficient beam-alignment scheme, robust against detection errors. Specifically, the beam-alignment sequence is designed such that the error-free feedback sequences are generated from a codebook with the desired error correction capabilities. Therefore, in the presence of detection errors, the error-free feedback sequences can be recovered with high probability. The assignment of beams to codewords is designed to optimize energy efficiency, and a water-filling solution is proved. The numerical results with analog beams depict up to 4dB and 8dB gains over exhaustive and uncoded beam-alignment schemes, respectively.