We report on the detection of a series of six lines in the ultra-deep Q-band integration towards IRC +10216 carried out with the Yebes 40m telescope, which are in harmonic relation with integer quantum numbers J u from 12 to 18. After a detailed analysis of all possible carriers, guided by high-level quantum chemical calculations, we conclude that the lines belong to HMgCCCN, named hydridomagnesium cyanoacetylide. The rotational temperature and column density derived for HMgCCCN are 17.1 ± 2.8 K and (3.0 ± 0.6) × 10 12 cm −2 , respectively. The observed abundance ratio between MgCCCN and HMgCCCN is approximately three. In addition, we report the discovery in space, also towards IRC +10216, of sodium cyanoacetylide, NaCCCN, for which accurate laboratory data are available. For this species we derived a rotational temperature of 13.5 ± 1.7 K and a column density of (1.2 ± 0.2) × 10 11 cm −2 .