After upgrade to 4.8, I get "Cast of Class /Script/Engine.BlueprintGeneratedClass to BlueprintGeneratedClass failed" on startup

Pretty much what the title says. I’ve tried it with both 4.8.0 and 4.8.1

My startup map’s blueprint was reparented to my custom c++ ALevelScriptActor, so I guessed maybe that was the problem. I’ve changed the startup map and sure enough the editor started up correctly, but crashed soon after with the same error while going through the content browser.

I saw this question https://answers.unrealengine.com/questions/233368/fatal-error-while-packagaing-failed-to-cast-class.html but the answer involves deleting blueprints. I’ve tried to delete a few of them, but the problem persisted and the other blueprints are essential to my game (I’m pretty deep in).

I’d very much like to upgrade to 4.8 but I’m hitting a brick wall here.

Here’s the stack trace:

UE4Editor-CoreUObject.dll!CastLogError(const wchar_t * FromType, const wchar_t * ToType) Line 11	C++
UE4Editor-Engine.dll!CastChecked<UBlueprintGeneratedClass,UClass>(UClass * Src, ECastCheckedType::Type CheckType) Line 195	C++
UE4Editor-Engine.dll!UActorComponent::PostLoad() Line 143	C++
UE4Editor-Engine.dll!ULightComponent::PostLoad() Line 422	C++
UE4Editor-Engine.dll!UPointLightComponent::PostLoad() Line 234	C++
UE4Editor-CoreUObject.dll!UObject::ConditionalPostLoad() Line 718	C++
UE4Editor-CoreUObject.dll!EndLoad() Line 1250	C++
UE4Editor-CoreUObject.dll!LoadPackageInternal(UPackage * InOuter, const wchar_t * InLongPackageName, unsigned int LoadFlags, FLinkerLoad * ImportLinker) Line 1006	C++
UE4Editor-UnrealEd.dll!UEditorEngine::Map_Load(const wchar_t * Str, FOutputDevice & Ar) Line 2291	C++
UE4Editor-UnrealEd.dll!UEditorEngine::HandleMapCommand(const wchar_t * Str, FOutputDevice & Ar, UWorld * InWorld) Line 5768	C++
UE4Editor-UnrealEd.dll!UEditorEngine::Exec(UWorld * InWorld, const wchar_t * Stream, FOutputDevice & Ar) Line 5262	C++
UE4Editor-UnrealEd.dll!UUnrealEdEngine::Exec(UWorld * InWorld, const wchar_t * Stream, FOutputDevice & Ar) Line 742	C++
UE4Editor-UnrealEd.dll!FEditorFileUtils::LoadMap(const FString & InFilename, bool LoadAsTemplate, const bool bShowProgress) Line 1992	C++
UE4Editor-UnrealEd.dll!FEditorFileUtils::LoadDefaultMapAtStartup() Line 3193	C++
UE4Editor-UnrealEd.dll!FUnrealEdMisc::OnInit() Line 300	C++
UE4Editor-UnrealEd.dll!EditorInit(IEngineLoop & EngineLoop) Line 86	C++
UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 133	C++
UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 189	C++

Hi Yousef,

I’m assuming that the project that is experiencing these issues was converted from 4.7.6 to 4.8.0 / 4.8.1. Is this the case? If so, could you try creating a new project in either 4.8.0 or 4.8.1 and migrating the content over instead? It is possible that something happened in the conversion process that is causing this issue.

Yes this was from 4.7.6.

I’ve created a project with the same name and migrated content over. I get the exact same error.

If I try it with the different project name, the blueprints keep referencing the old project name and fail to work.

Is there anything else I can try?

The first thing we should do is narrow down the culprit. I see that you mentioned deleting various blueprints to see if a certain one was causing this issue, but can you try moving the content folder out of the project to see if it allows you to open the project at that point? If that works, try returning the content folder and removing the Blueprints themselves, then slowly add them back one-by-one until the crash occurs again.

If you’re unable to determine which blueprint it is by this method, can you send me a copy of the project so that I can mess with it hands-on? If you wish for it to stay private, you can upload the project to a third party hosting site and send the link to me in a private message on the forums, where my username is .

I’ve sent you a message on the forums.

Hi Yousef,

Thank you for providing me with the project so that I could take a hands-on look at the crash. I’m able to reproduce it without an issue and I’ve also narrowed it down a little bit. It seems as though something that is being put into both the Example_Map and test1 maps is causing this crash to occur. If you remove the test1 map from the project or change the default map to anything other than those before converting you can launch the project without an issue.

I’ll still be looking at this to determine as to why exactly those maps are causing the editor to crash but I wanted to give you an update as you’re more familiar with your assets than I am.

The only difference with those two maps is that they are reparented to my own C++ LevelScriptActor called CustomLevelScriptActor. I did change the map but then the editor crashed again while I tried to play with other blueprints not related to the level.

I’ve done some more trial and error and it seems like the error is something in the level blueprint for these two levels. I tried simply reparenting the two levels to not using your Custom Level Script Actor but they still caused a crash when converting to 4.8 but removing all of the nodes in the Level Blueprint stopped the crash completely. I’ll be focusing on trying to narrow it down further but this would be a good place to start.

Hi Yousef,

We haven’t heard from you in a while. I’ve yet to make any progress in narrowing this down further but I’m curious to see if you have had any luck.

No luck, but I didn’t work on it hard enough yet as I’m out of the country.

Where would “/Script/Engine.BlueprintGeneratedClass” come from in the first place? I’ve tried to search through the binaries and none of them mention /Script/Engine.BlueprintGeneratedClass in both versions. I’m not really sure where to go from here.

The BlueprintGeneratedClass code can be found at the following file path

\Engine\Source\Runtime\Engine\Classes\Engine\BlueprintGeneratedClass.h

If you get the chance, can you try to see if this issue persists when upgrading to 4.9 Preview 1?

Whoa it actually didn’t crash on 4.9 preview 1! However, there’s like 317 load errors for core UE4 classes, all complaining about ActiveClassRedirects containing a collision with multiple redirectors. I do have a LOT of ActiveClassRedirects lines in DefaultEngine.ini, possibly since I upgraded from 4.6 to 4.7 at some point. Do I just delete them?

However, the game seems to be ok, with a few glitches (ai doesn’t work) but I’m sure I can fix that.

You can try deleting them but they may break something else depending on what has been changed through your multiple conversions. If you do wish to try this, please be sure to make a copy of the entire project first to be safe. I’ll be looking into this further but I wanted to give an initial response.

Hi Yousef,

Have you had a chance to try deleting the ActiveClassRedirects to see if these errors disappear?

They actually do disappear :slight_smile: I don’t see any real problems as of right now.

I’ll keep this project on hold until 4.9 is out. Thanks Matt!

No problem and I’m glad to hear that it’s working out for you!
If you ever need anymore help, please let us know.

P.S. I like the Tarutaru profile pic :slight_smile:

Thank you! I think I added it to Gravatar 8 years ago or something and I completely forgot about it. Funny to see it still popping up.