Material error message during build, can't locate the error, plz help!

Hello,
I’m getting the following error during windows build with UE5.0 (DX12):

UATHelper: Packaging (Windows): [2/13] Compile SharedPCH.Engine.ShadowErrors.cpp
UATHelper: Packaging (Windows): /Engine/Generated/Material.ush:2560:55: error: reference to local variable 'Thickness' declared in enclosing function 'CustomExpression0'
UATHelper: Packaging (Windows): /Engine/Generated/Material.ush:2584:19: error: reference to local variable 'colors' declared in enclosing function 'CustomExpression0'
UATHelper: Packaging (Windows): D3DCompileToDxil failed. Error code: Unbekannter Fehler (0x80004005).
UATHelper: Packaging (Windows): /Engine/Generated/Material.ush:2560:55: error: reference to local variable 'Thickness' declared in enclosing function 'CustomExpression0'
UATHelper: Packaging (Windows): /Engine/Generated/Material.ush:2584:19: error: reference to local variable 'colors' declared in enclosing function 'CustomExpression0'
PackagingResults: Error: reference to local variable 'Thickness' declared in enclosing function 'CustomExpression0'
PackagingResults: Error: reference to local variable 'colors' declared in enclosing function 'CustomExpression0'
PackagingResults: Error: reference to local variable 'Thickness' declared in enclosing function 'CustomExpression0'
PackagingResults: Error: reference to local variable 'colors' declared in enclosing function 'CustomExpression0'

Looks like some material has a custom expression that is not working, but how do I find out which one is it? How can I track down this error? Any help would be great! Thanks!

Kind regards,
Chris

It looks like the erroring function is question is called CustomExpression0. I don’t think you can really add a function to a material so try opening up a blueprint and pressing ctrl + f and searching for that function name in all blueprints like so:

Thanks for the quick reply, I tried it:

I think you can make custom functions in materials, see here:

I didn’t create any custom material functions, but I think one of the assets or plugins I’m using has it, but hard to say which one it is.

Do you see any named CustomExpression0 by searching the content browser?

I also tried that, I selected the All folder and typed in CustomExpression0, I think this is not working, because it does not look into material files.

Luckily I found it, I checked the materials from the AcientContent, because I thought, hm this stuff might be outdated with the new UE5 update and it was indeed the Debug material from the AcientOneCore.
I still get a crash when running my game, but this is caused, by another issue, it happens while loading a sequence. But this is a topic for a new thread, for me, this one is solved! Thanks for the support anyway!