Help With Perforce Error - Unable to stop perforce from checking when using GIT

I haven’t seen these errors before, mostly because I’ve been using GIT (LFS) for personal backups over Perforce. The steps to repeat what I did were to try and commit from the application (Unreal Engine 5) and then not seeing anything for a bit I impatiently pushed from the git app, as well. Somehow this seems to have confused Unreal engine into thinking I wanted to use perforce? (Which is installed on my PC and I had used on a previous project)

Has anyone come across the “Not marked for add” error with perforce? Note, I use GIT LFS. I tried googling this and nothing comes up. I tried disabling and re-enabling the source control with git, but it still won’t “forget” the perforce option. Also it was found that this error was occuring when hitting check content and I was unsure if related to the main issue or not?

LogLyraEditor: Warning: Assets to validate (2943) exceeded -MaxPackagesToLoad=(2000). Skipping existing package validation.
AssetCheck: Warning: Assets to validate (2943) exceeded -MaxPackagesToLoad=(2000). Skipping existing package validation.

I tried setting this to:
int32 MaxPackagesToLoad = 3000;

Below are the Message Log errors I’m receiving:
[AssetLog] G:\Active\LyraStarterGame\Content\System\DefaultEditorMap\L_DefaultEditorOverview.umap: References /Engine/EngineMaterials/WorldGridMaterial which is not marked for add in perforce. (EditorValidator_SourceControl)
[AssetLog] G:\Active\LyraStarterGame\Content\System\DefaultEditorMap\L_DefaultEditorOverview.umap: References /Engine/EngineSky/BP_Sky_Sphere which is not marked for add in perforce. (EditorValidator_SourceControl)
[AssetLog] G:\Active\LyraStarterGame\Content\System\DefaultEditorMap\L_DefaultEditorOverview.umap: References /Engine/EngineSky/M_Sky_Panning_Clouds2 which is not marked for add in perforce. (EditorValidator_SourceControl)
[AssetLog] G:\Active\LyraStarterGame\Content\System\DefaultEditorMap\L_DefaultEditorOverview.umap: References /LyraExampleContent/Materials/MI_MS_Blue_1 which is not marked for add in perforce. (EditorValidator_SourceControl)
[AssetLog] G:\Active\LyraStarterGame\Content\System\DefaultEditorMap\L_DefaultEditorOverview.umap: References /Engine/BasicShapes/Cube which is not marked for add in perforce. (EditorValidator_SourceControl)
[AssetLog] G:\Active\LyraStarterGame\Content\System\DefaultEditorMap\L_DefaultEditorOverview.umap: References /LyraExampleContent/Materials/MI_MS_Orange_1 which is not marked for add in perforce. (EditorValidator_SourceControl)
[AssetLog] G:\Active\LyraStarterGame\Content\System\DefaultEditorMap\L_DefaultEditorOverview.umap: References /Engine/BasicShapes/BasicShapeMaterial which is not marked for add in perforce. (EditorValidator_SourceControl)
/Game/System/DefaultEditorMap/L_DefaultEditorOverview contains invalid data.
Data validation FAILED.
Files Checked: 1, Passed: 0, Failed: 1, Skipped: 0, Unable to validate: 0

1 Like

I have the same error using SVN with a Lyra project.

I actually deleted the entire git repo (both locally removing git files and on the server) and redid it more patiently and the error still exists.

Receiving the same error, even after deleting and recloning. Currently using git with an Azure Repos remote. I can seemingly still commit changes to the asset from what I can tell, but only using Sourcetree. When trying to save any asset in-editor, I get the errors. **Also using the Lyra project.

– This is the specific error from the output log in Rider.

Log LogSlate Window ‘Submit Files’ being destroyed
Log LogSourceControl commit successful: [dev 06bab30f] Test
Log SourceControl [dev 06bab30f] Test
Log SourceControl 1 file changed, 0 insertions(+), 0 deletions(-)
Log SourceControl Commited [dev 06bab30f] Test.
Log AssetCheck New page: Asset Save: B_ControlPointScoring
Display LogContentValidation Validating Blueprint /ShooterCore/ControlPoint/B_ControlPointScoring.B_ControlPointScoring
Error AssetCheck [AssetLog] C:\Repos*\Plugins\GameFeatures\ShooterCore\Content\ControlPoint\B_ControlPointScoring.uasset: References /Engine/EditorBlueprintResources/ActorComponentMacros which is not marked for add in perforce. (EditorValidator_SourceControl)
Error AssetCheck [AssetLog] C:\Repos*
\Plugins\GameFeatures\ShooterCore\Content\ControlPoint\B_ControlPointScoring.uasset: References /Engine/EditorBlueprintResources/StandardMacros which is not marked for add in perforce. (EditorValidator_SourceControl)
Log AssetCheck /ShooterCore/ControlPoint/B_ControlPointScoring contains invalid data.
Log AssetCheck Data validation FAILED.
Log AssetCheck Files Checked: 1, Passed: 0, Failed: 1, Skipped: 0, Unable to validate: 0
Warning LogPackageName FPackagePath::TryFromMountedName was passed an ObjectPath (/ShooterCore/ControlPoint/B_ControlPointScoring.B_ControlPointScoring) rather than a PackageName or FilePath; it will be converted to the PackageName. Accepting ObjectPaths is deprecated behavior and will be removed in a future release; TryFromMountedName will fail on ObjectPaths.

– Seemingly an issue with the Blueprint referencing an engine asset that’s not part of the repo? Here’s the C++ validation that’s occurring, causing the failure:

EDataValidationResult UEditorValidator_SourceControl::ValidateLoadedAsset_Implementation(UObject* InAsset, TArray& ValidationErrors)
{
check(InAsset);

FName PackageFName = InAsset->GetOutermost()->GetFName();
if (FPackageName::DoesPackageExist(PackageFName.ToString()))
{
	ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
	FSourceControlStatePtr AssetState = SourceControlProvider.GetState(SourceControlHelpers::PackageFilename(PackageFName.ToString()), EStateCacheUsage::Use);
	if (AssetState.IsValid() && AssetState->IsSourceControlled())
	{
		FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
		IAssetRegistry& AssetRegistry = AssetRegistryModule.Get();

		// Check for assets that are submitted to source control that reference assets that are not
		static const FString ScriptPackagePrefix = TEXT("/Script/");
		TArray<FName> Dependencies;
		AssetRegistry.GetDependencies(PackageFName, Dependencies, UE::AssetRegistry::EDependencyCategory::Package);
		for (FName Dependency : Dependencies)
		{
			const FString DependencyStr = Dependency.ToString();
			if (!DependencyStr.StartsWith(ScriptPackagePrefix))
			{
				FSourceControlStatePtr DependencyState = SourceControlProvider.GetState(SourceControlHelpers::PackageFilename(DependencyStr), EStateCacheUsage::Use);
				if (DependencyState.IsValid() && !DependencyState->IsSourceControlled())
				{
					AssetFails(InAsset, FText::Format(LOCTEXT("SourceControl_NotMarkedForAdd", "References {0} which is not marked for add in perforce"), FText::FromString(DependencyStr)), ValidationErrors);
				}
			}
		}
	}
}

Also, these blueprints are unchanged, and I haven’t made any modifications to them.

I’m having this issue, but I’m using Plastic. Also building on top of Lyra.

Repro steps are to duplicate and rename the “W_LyraSettingsScreen” asset and attempt to save it, since it depends on “/CommonUI/GenericInputActionDataTable” which is in “Engine/Plugins/CommonUIPluginContent/”

Really, it shouldn’t have a problem with any unchanged assets right?

Ditto, using Tortoise SVN with Lyra.

Nobody seems to have a solution for this.

It seems like UE5 is just fundamentally broken if you use Git rather than Perforce. The only way to get UE5 to shut up is to disable its internal version control and manage version control externally via real Git tools.

Am I mistaken?

The error is introduced by code that is in the Lyra source code, not the engine. Check out the ValidateLoadedAsset_Implementation() function in /Source/LyraEditor/Validation/EditorValidator_SourceControl.cpp:

EDataValidationResult UEditorValidator_SourceControl::ValidateLoadedAsset_Implementation(UObject* InAsset, TArray<FText>& ValidationErrors)
{
	check(InAsset);

	FName PackageFName = InAsset->GetOutermost()->GetFName();
	if (FPackageName::DoesPackageExist(PackageFName.ToString()))
	{
		ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
		FSourceControlStatePtr AssetState = SourceControlProvider.GetState(SourceControlHelpers::PackageFilename(PackageFName.ToString()), EStateCacheUsage::Use);
		if (AssetState.IsValid() && AssetState->IsSourceControlled())
		{
			FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
			IAssetRegistry& AssetRegistry = AssetRegistryModule.Get();

			// Check for assets that are submitted to source control that reference assets that are not
			static const FString ScriptPackagePrefix = TEXT("/Script/");
			TArray<FName> Dependencies;
			AssetRegistry.GetDependencies(PackageFName, Dependencies, UE::AssetRegistry::EDependencyCategory::Package);
			for (FName Dependency : Dependencies)
			{
				const FString DependencyStr = Dependency.ToString();
				if (!DependencyStr.StartsWith(ScriptPackagePrefix))
				{
					FSourceControlStatePtr DependencyState = SourceControlProvider.GetState(SourceControlHelpers::PackageFilename(DependencyStr), EStateCacheUsage::Use);
					if (DependencyState.IsValid() && !DependencyState->IsSourceControlled())
					{
						AssetFails(InAsset, FText::Format(LOCTEXT("SourceControl_NotMarkedForAdd", "References {0} which is not marked for add in perforce"), FText::FromString(DependencyStr)), ValidationErrors);
					}
				}
			}
		}
	}

	if (GetValidationResult() != EDataValidationResult::Invalid)
	{
		AssetPasses(InAsset);
	}

	return GetValidationResult();
}

Somewhere in that function is what is throwing the error. I’m not sure why, though - this may be an engine problem manifesting. Either way, you can just replace it with the following to “disable” the check:

EDataValidationResult UEditorValidator_SourceControl::ValidateLoadedAsset_Implementation(UObject* InAsset, TArray<FText>& ValidationErrors)
{
    // FIXME
    return EDataValidationResult::Valid;
}
2 Likes

Resolved: It seems it should be excluding both the Script directory AND the Engine directory. Adding a secondary check for the Engine resolves the error and keeps the validation for other content.

static const FString EnginePackagePrefix = TEXT("/Engine/");
if (!DependencyStr.StartsWith(ScriptPackagePrefix) && !DependencyStr.StartsWith(EnginePackagePrefix))

Complete function:

EDataValidationResult UEditorValidator_SourceControl::ValidateLoadedAsset_Implementation(UObject* InAsset, TArray<FText>& ValidationErrors)
{
    check(InAsset);

    FName PackageFName = InAsset->GetOutermost()->GetFName();
    if (FPackageName::DoesPackageExist(PackageFName.ToString()))
    {
        ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
        FSourceControlStatePtr AssetState = SourceControlProvider.GetState(SourceControlHelpers::PackageFilename(PackageFName.ToString()), EStateCacheUsage::Use);
        if (AssetState.IsValid() && AssetState->IsSourceControlled())
        {
            FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
            IAssetRegistry& AssetRegistry = AssetRegistryModule.Get();

            // Check for assets that are submitted to source control that reference assets that are not
            static const FString ScriptPackagePrefix = TEXT("/Script/");
            static const FString EnginePackagePrefix = TEXT("/Engine/");
            TArray<FName> Dependencies;
            AssetRegistry.GetDependencies(PackageFName, Dependencies, UE::AssetRegistry::EDependencyCategory::Package);
            for (FName Dependency : Dependencies)
            {
                const FString DependencyStr = Dependency.ToString();
                if (!DependencyStr.StartsWith(ScriptPackagePrefix) && !DependencyStr.StartsWith(EnginePackagePrefix))
                {
                    FSourceControlStatePtr DependencyState = SourceControlProvider.GetState(SourceControlHelpers::PackageFilename(DependencyStr), EStateCacheUsage::Use);
                    if (DependencyState.IsValid() && !DependencyState->IsSourceControlled())
                    {
                        AssetFails(InAsset, FText::Format(LOCTEXT("SourceControl_NotMarkedForAdd", "References {0} which is not marked for add in perforce"), FText::FromString(DependencyStr)), ValidationErrors);
                    }
                }
            }
        }
    }

    if (GetValidationResult() != EDataValidationResult::Invalid)
    {
        AssetPasses(InAsset);
    }

    return GetValidationResult();
}
5 Likes

I modified LyraEditor/Validation/EditorValidator_SourceControl.cpp as you suggested @EveryGoodWork but I’m still getting false positives with a Git repository.

It seems that DependencyState->IsSourceControlled() is erroneously returning false for files that are indeed committed to Git.

For example, many errors such as this, where the file in question is definitely already committed to the Git repository and is also unmodified:

[AssetLog] C:\Boj\LyraInteraction\Plugins\GameFeatures\ShooterMaps\Content\PROTO\InventoryTest\LAS_InventoryTest.uasset: References /ShooterMaps/PROTO/InventoryTest/Input/Mappings/IMC_InventoryTest which is not marked for add in perforce. (EditorValidator_SourceControl)

Following up on this – UE5’s Git integration DOES NOT WORK WITH SUBMODULES.

That was part of my problem. I was organizing my reusable libraries into submodules, as is standard practice in the Git community, but that has the side effect of completely breaking UE5’s Git functionality.

Once I (barf) duplicated (barf) my library code into a single project Git repository, then I was finally able to view diffs of blueprints, data assets, etc.

Having gotten that far, I was still having tons of problems with Lyra erroneously telling me that assets were not committed to Perforce. I applied @cheese.team.jon’s suggestion of disabling this check, and now Git is working great with no false positive errors.

His fix, with my comments so I know in future merging why I deleted this function:

EDataValidationResult UEditorValidator_SourceControl::ValidateLoadedAsset_Implementation(UObject* InAsset, TArray<FText>& ValidationErrors)
{
	// [xist] Lyra source control validation does not work with Git.
	//        Disable infinite false positive errors until they fix it.
	return EDataValidationResult::Valid;
}

I think they fixed this in the most recent update, btw! Either the lyra project or the engine… either way updating both it seems to work normally now for me. At least the annoying errors havent shown themselves yet.

Hi, all. I had this problem in UE 5.1 with the Lyra project.
The solutions above did not work for me unfortunately, but if all you want to do is stop the editor from nagging you, just go to

Editor Preferences > Advanced > Data Validation > Validate on Save
and uncheck that box.

Doesn’t really solve the problem, but it sure is nice to save my project without being harassed by the editor.

1 Like