Can't save blueprints using custom macros from a macro library

I have some macros stored in a Widget Macro Library. I don’t think I ever had problems with them in the past. Now whenever I try and save a blueprint with a macro that comes from one of these libraries, the editor gives me an error that says “Graph is linked to private object(s) in an external package.” I’ve had to add the referenced macros into each individual blueprint to save them. Why is this happening?

I got this recently and managed to solve it, though I can’t be 100% certain that all cases of this problem are the same; still, I thought it was worth sharing just in case.

Here's what I did.
  1. Select the macro node that’s causing a problem (the instance in the blueprint that won’t save, not the definition in the macro library). Copy it.
  2. Open up a text editor and paste it in. You should see a textual description of the macro instance node – the first line should look like this (if it doesn’t, you copied the wrong thing):
    Begin Object Class=/Script/BlueprintGraph.K2Node_MacroInstance Name="K2Node_MacroInstance_1"
    
  3. On the second line, you’ll see the path to the macro node. It should look something like this:
    MacroGraphReference=(MacroGraph=EdGraph'"/Module/MacroLibraryName.MacroLibraryName:MacroName"',GraphBlueprint=Blueprint'"/Module/MacroLibraryName.MacroLibraryName"',GraphGuid=...omitted...)
    
    But in my case, it instead looked something like this:
    MacroGraphReference=(MacroGraph=EdGraph'"/Module/MacroLibraryName.MacroName"',GraphBlueprint=Blueprint'"/Module/MacroLibraryName.MacroLibraryName"',GraphGuid=...omitted...)
    
    If you can’t see the difference, look at the string after EdGraph and note that the macro library name appears only once instead of twice, and there’s no colon.
  4. If it looks like the second, just make it look like the first (duplicate the macro library name and add a colon). Then select all that text and copy-paste it into Unreal to replace the bad node, and you should be able to save.

EDIT: Okay, I spoke too soon. That really did solve it… until I made some code changes and reopened the editor. Now it’s back, and the above solution no longer works. I suspect there may be some issue with the macro library itself, but it’s hard to figure out what that might be…

EDIT2: Recreating the macro in the macro library from scratch appears to genuinely fix the issue. That is, create a new macro and copy-paste the nodes from the old one to the new one (the old one can then be deleted).