Assertion failed: IsValid() [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\Templates\SharedPointer.h] [Line: 1113]

Hello everyone!!

Suddenly one morning when i tried to open the UE editor 5.4, I am constantly gettting this error message. I have tried all the fixes given in the internet.

-Uninstalled and re installed it
-Tried deleting saved and intemediate folders
-tried fixing VS

It is really annoying that one day you wake up and nothing works. Anyone from @Epic_ELT or any devoloper can help me fix this? Would be super helpful.

LoginId:d820a7c940745089ba5119a0f73ac6a5
EpicAccountId:cad24c910585451fb8017bda10387dc8

Assertion failed: IsValid() [File:D:\build++UE5\Sync\Engine\Source\Runtime\Core\Public\Templates\SharedPointer.h] [Line: 1113]

UnrealEditor_Slate
UnrealEditor_Slate
UnrealEditor_Slate
UnrealEditor_Slate
UnrealEditor_Slate
UnrealEditor_Slate
UnrealEditor_Slate
UnrealEditor_Slate
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
kernel32
ntdll

that doesn’t show enough info.
install debug symbols (under options for the current engine)
also try sharing the logs.

Hey there, did you manage to fix the problem?

Had the same error and crash with UE 5.44 → figured out more or less what caused it. I guess it can multiple different reasons to get this error. In my case: an http-Plugin i used, caused it on “Post call” (so basically calling a website to write something there). The confusing part was: it worked super in editor and crashed in packaged version.

I did this to fix this error for me;

The action just previous to the start of this error;
I was installing a plugin to Unreal Engine 5.6.0 called 3Dconnexion Plugin for Unreal Editor. During the installation the Epic Games Launcher crashed with the following message and would not restart after many attempts.

Assertion failed: IsValid() [File:D:\build++Portal\Sync\Engine\Source\Runtime\Core\Public\Templates/SharedPointer.h] [Line: 890]

I navigated to the file and opened with MS Visual Studio 2022 and scrolled down to line #890 and found the following code;

886 /**
887 * Aliasing constructor used to create a shared pointer which shares its reference count with
888 * another shared object, but pointing to a different object, typically a subobject.
889 *
890 * @param OtherSharedRef The shared reference whose reference count should be shared.
891 * @param InObject The object pointer to use (instead of the incoming shared pointer’s object)
892 /
893 template
894 FORCEINLINE TSharedPtr( TSharedRef< OtherType, Mode > const& OtherSharedRef, ObjectType
InObject )
895 : Object( InObject )
896 , SharedReferenceCount( OtherSharedRef.SharedReferenceCount )
897 {
898 }

I copied these lines of code into an AI code debug site and it came back with;

START

Debugging the TSharedPtr Constructor

Code Summary

The provided code snippet defines a constructor for a template class TSharedPtr, which is designed to create a shared pointer that shares its reference count with another shared object. This is particularly useful when dealing with subobjects.

Problem

Upon reviewing the code, there is a potential issue with the constructor’s initialization list. Specifically, the SharedReferenceCount member is being initialized directly from OtherSharedRef.SharedReferenceCount, which may not be the intended behavior if SharedReferenceCount is not properly defined or if it does not exist in the context of TSharedPtr.

Cause

The root cause of the problem lies in the assumption that SharedReferenceCount is a valid member of the TSharedPtr class. If SharedReferenceCount is not defined within the class, or if it is not intended to be initialized in this manner, it will lead to compilation errors or undefined behavior.

Solution

To resolve this issue, ensure that SharedReferenceCount is a valid member of the TSharedPtr class. If it is intended to be a reference count, it should be properly defined and initialized. Here is a corrected version of the constructor, assuming SharedReferenceCount is a member of the class:

END

SUGGESTED CODE FIX

template
FORCEINLINE TSharedPtr(TSharedRef<OtherType, Mode> const& OtherSharedRef, ObjectType* InObject)
: Object(InObject)
, SharedReferenceCount(OtherSharedRef.GetReferenceCount()) // Assuming GetReferenceCount() is a valid method
{
}

END

ANALYSIS AND SUMMARY

I then compared the lines of code with each one of the suggested correction and the original and discovered line 896 was missing a set of Parentheses at the end of code just before the closing parenthese. So I added them, saved the changes and Unreal Engine Launcher is working good.

886 /**
887 * Aliasing constructor used to create a shared pointer which shares its reference count with
888 * another shared object, but pointing to a different object, typically a subobject.
889 *
890 * @param OtherSharedRef The shared reference whose reference count should be shared.
891 * @param InObject The object pointer to use (instead of the incoming shared pointer’s object)
892 /
893 template
894 FORCEINLINE TSharedPtr( TSharedRef< OtherType, Mode > const& OtherSharedRef, ObjectType
InObject )
895 : Object( InObject )
896 , SharedReferenceCount( OtherSharedRef.SharedReferenceCount () )
897 {
898 }

A final note;

I did another check as I had removed the Parentheses then saved and restarted Unreal Engine Launcher and it worked fine with no issues after installing the named plugin.

So to Summarize, I think the error was created when the plugin installation was being installed and the launcher crashed before completing the install which wouldn’t allow the Launcher to restart so after adding the Parentheses and then finishing the install, the launcher doesn’t require that line of code so no errors. I’m leaving the Parentheses in the code. I was successful to install the plugin in 5.6.0 with no further issues.

HOPE THIS HELPS SOMEONE!