Pitch Detection / Harmonic Product Spectrum - What's wrong?
The Harmonic Product Spectrum pitch estimation method, using pure multiplication weighting, only works well for signals that have a full set of harmonics with sufficient magnitudes.  Before using HPS, one should either validate that the signal in question meets that criteria, or add a suitably large non-zero floor to all harmonic magnitudes being multiplied together.  Otherwise a pure sinewave with zero harmonics will simply disappear from the result after being multiplied by a zero magnitude.

Guitar and ukulele sounds usually have a far richer set of harmonics than test sine waves.