Treasure hunter freed from jail after refusing to turn over shipwreck gold

https://www.bbc.com/news/articles/cg4g7kn99q3o

Treasure hunter freed from jail after refusing to turn over shipwreck gold

Tommy Thompson spent more than a decade in prison after refusing to disclose the whereabouts of 500 missing gold coins.

The real story here is that civil contempt can net you an indefinite prison sentence without a conviction, and if you're lucky a judge will decide to let you out. Over something you may or may not even know.
How else could it possibly work? The justice system depends on judges being able to compel action. Within the guardrails established by the system (e.g. no self-incriminating testimony, if you’re in the US), I don’t have a problem with refusal to e.g. turn over evidence just resulting in detention until you comply. It’s not a prison sentence, since you can get out any time you want.

Doesn't this give the government the unchecked ability to detain whoever they want indefinitely, then?

They could just demand someone turn over evidence that doesn't exist, or that they know the person doesn't know about?

Isn’t that exactly what this article is about? A guy that was released from jail on contempt because it can’t be used indefinitely?
After a decade in prison without being charged.
He was charged, with contempt.