The HRE had a
very tenuous claim. They didn't even use the name until hundreds of years in, and most of their emperors were not crowned by any popes. Their claim was basically that the HRE was a successor to East Francia, which lands had been part of the Carolingian Empire, which had been ruled by Charlemagne, who had been crowned emperor by the pope in attempt to stake out his own very tenuous claim to be the continuation of the West Roman Empire (which had basically been defunct for centuries by then).
Couple that with the invented principle of translatio imperii [1], and they glossed over the multiple long breaks in lineage, and lack of even an unbroken connection between the territories ruled.
There's the old joke about the HRE: It was neither Holy, Roman or an Empire - the emperor ruled on paper, but it had very limited practical effect other than letting a smaller and smaller set of families reflect in the glory of an Emperor title.
[1] https://en.wikipedia.org/wiki/Translatio_imperii