HCN is becoming a popular choice of molecule for studying star formation in both low- and high-mass regions and for other astrophysical sources from comets to high-redshift galaxies. However, a major and often overlooked difficulty with HCN is that it can exhibit dramatic non-local thermodynamic equilibrium (non-LTE) behaviour in its hyperfine line structure. Individual hyperfine lines can be strongly boosted or suppressed. In low-mass star-forming cloud observations, this could possibly lead to large errors in the calculation of opacity and excitation temperature, while in massive star-forming clouds, where the hyperfine lines are partially blended due to turbulent broadening, errors will arise in infall measurements that are based on the separation of the peaks in a self-absorbed profile. This is because the underlying line shape cannot be known for certain if hyperfine anomalies are present. We present a first observational investigation of these anomalies across a wide range of conditions and transitions by carrying out a survey of low-mass starless cores (in Taurus and Ophiuchus) and high-mass protostellar objects (in the G333 giant molecular cloud) using hydrogen cyanide (HCN) and emission lines. We quantify the degree of anomaly in these two rotational levels by considering ratios of individual hyperfine lines compared to LTE values. We find that all the cores observed demonstrate some degree of anomaly while many of the lines are severely anomalous. We conclude that HCN hyperfine anomalies are common in both lines in both low-mass and high-mass protostellar objects, and we discuss the differing hypotheses for the generation of the anomalies. In light of the results, we favour a line overlap effect for the origins of the anomalies. We discuss the implications for the use of HCN as a dynamical tracer and suggest in particular that the hyperfine line should be avoided in quantitative calculations.