So I’ve always seen that in wills, people assign their assets to a loved one or even to institutions they like (some church, some research institute, etc.). In these many of thes e cases, the people named in the will may not have expressly agreed to being named in the will.
Can debt be willed this way? Like all my debt now belongs person X or institute Y?
Like what if everyone just wrote, my student debt belongs to J.K Rowling in their will?


They still do that, in a way. It actually takes some serious planning (at least in the US) to avoid, and isn’t a fun way of spending a bunch of money.
End of life medical care is very, very expensive. It will quickly eat through an entire inheritance if not carefully planned and structured. But once they die, the estate is worth less than $0, sticking any remaining debt to the medical companies (nursing homes are often vultures) or the government, depending on the details.
Those companies aren’t stuck with the real bill. They overcharged so much on the care they make plenty of profit.