UserWidget fails to ensure(InWidgetTree) in Duplication and crashes when compiling the BP

I’ve got a set of custom UserWidget BPs making up my initial Main Menu and my Pause Menu. When I open my “PauseMenuRoot” UserWidget BP for editing, I fail this ensure:

UUserWidget::DuplicateAndInitializeFromWidgetTree(UWidgetTree* InWidgetTree)
ensure(InWidgetTree)
InWidgetTree is NULL.

Furthermore attempting to compile the “PauseMenuRoot” BP leads to failing this check:

FObjectDuplicationParameters::FObjectDuplicationParameters( UObject* InSourceObject, UObject* InDestOuter )
checkSlow(SourceObject);
SourceObject (which refers to WidgetClass->WidgetTree) is NULL.

“PauseMenuRoot” worked just fine until I added the seemingly unrelated “MainMenuRoot” UserWidget BP. The only thing that connects them is that they both make use of another custom widget, “LoadSlotButton”. Removing the references to “LoadSlotButton” from “MainMenuRoot” allows me to compile “PauseMenuRoot” without crashing the editor. This confuses me.

The last bit of info is that it seems to decide whether it’s going to crash or not when the editor is opened. I can’t just test a change that I’ve made, I need to save everything and restart the editor to know if my change results in a crash or not.

Tldr: “PauseMenuRoot” BP crashes on compile if the following conditions are met
-“PauseMenuRoot” and “MainMenuRoot” both use “LoadSlotButton”
-The editor has been closed and reopened at some point after the above conditions have been met
“MainMenuRoot” does not crash on compile.

Any ideas what might be causing this or leads for how to track this down?

Callstack from ensure(InWidgetTree)

Callstack from checkSlow(SourceObject)

Did you ever get anywhere with this? I’m having the same issue. I tried deleting Intermediate, Binaries, and Saved but it didn’t help. I also tried reverting my widget bp and re-doing my changes and it happened again.

I have not yet figured this one out. It’s on the backburner, but I’ll eventually need to tackle it.

Having the same issue here, wish there was a known solution.

bump. Hope a solution to this is found.

My 4.16 project became littered with these all of a sudden. I couldn’t compile a bunch of my widget blueprints without crashing with this error.

Upgrading to 4.18 resolved all of these and I haven’t seen one since.

This issue still exists in UE 4.22.

Process to replicate:

  1. Create Mode Tool plugin
  2. Edit the slate init function to resemble this file. and create an Editor Widget Blueprint, changing the FindObject path to match.

Then follow this process:

  1. Trying to instantiate the UI in the tab results in “Ensure(InWidgetTree)” failing to pass during CreateWidget.
  2. Recompiling the blueprint crashes due to a cast failing: CastLogError()
  3. Reload, duplicate blueprint, delete old blueprint, rename new blueprint to the same. Show tab. Everything works including recompilation.
  4. Reload, back to step 1.

This is very broken. Does anyone know how to fix it yet?

Was dealing with this same issue in 4.25. I can’t tell from the stacktraces above, but for me the issue was caused by one of my Widgets being REINST, which causes it not to have a valid Widget tree. You can check this by going into the stacktrace when the ensure fails and going back until you find the class of the widget that is causing the problem (check the values of the variables, especially around the initialize() function)

(For context on REINST see: What is "REINST_" and why is it occuring?)

REINST happens when widgets are nested, which can cause circular dependencies. The solution seems to be to create an interface in the blueprint to prevent the circular reference.

1 Like