Has any incumbent POTUS ever sought and failed to gain his party's nomination for re-election?

Yes, that would be the health problem I mentioned. But Wilson was still seeking a third term even after his stroke.

Apparently he suffered from kidney disease and showed definite signs of illness toward the end of his term.

There were also rumors that he was actually born in Ireland or Canada. No word on whether these rumors were studied by investigators that couldn’t believe what they were finding.