UUserWidget::GetContentForSlot returns null, but there's definitely something in the slot.

I have a UMG widget that has some NamedSlots in it. I have put one UImage in each of the slots. Calling GetContentForSlot for any of the slots returns null. I can see that the widgets I put in the slots are there, because I see the correct image rendering. I’m not typing the names wrong because I tried iterating over the return value of GetSlotNames and GetContentForSlot with it (Yes, it has all the expected slots in it). Manually adding a widget with SetContentForSlot works, GetContentForSlot returns the expected widget afterwards.
What am I doing wrong?