You can be held in contempt of court indefinitely.
[0]https://arstechnica.com/tech-policy/2020/02/man-who-refused-...
> After losing that appeal, Rawls raised another challenge: the federal statute that allows judges to hold witnesses in contempt for refusing to testify, passed in 1970, states that "in no event shall such confinement exceed eighteen months."
This limit does not apply if you are not a witness.
It's different when you're a defendant or a party to the proceeding.