Bug when saving a material instance

I’m getting the following bug when saving a material instance in Unreal.

LogOutputDevice: Error: Ensure condition failed: false [File:D:\Build++UE4+Release-4.18+Compile\Sync\Engine\Source\Runtime\Renderer\Private\ShaderBaseClasses.cpp] [Line: 224]
TBasePassVSFPrecomputedVolumetricLightmapLightingPolicy shader uniform expression set mismatched shader map for material MaterialInstanceDynamic_26/WorldGridMaterial, forcing expression cache evaluation.
Material: Material /Engine/EngineMaterials/WorldGridMaterial.WorldGridMaterial
Proxy: MaterialInstanceDynamic /Engine/Transient.MaterialInstanceDynamic_26

Unsure what is causing this.

I gave up and I’m no longer creating a material instance for this inside of the editor. Instead I’m just creating a dynamic material on the constructor for the actor blueprint.

I have a simillarly inexplicable issue where an Ensure for “UE-46061 - Workaround for a rare crash with an outdated cached shader map” triggers, though I again have no idea why it is outdated in the first place.

Disabling the Uniform Expression Cache with the CVar r.AllowCachedUniformExpressions=0 at least works around the issue.