Please help compiler error "Error: Bad name index -1/534"

Please help, I don’t know what to do. Almost a year into the game, near the end and I am getting this compiler error. Please someone tell me you know how to fix that. Attaching log also here

    UATHelper: Packaging (Windows (64-bit)):   LogInit: Display:
    UATHelper: Packaging (Windows (64-bit)):   LogInit: Display: Warning/Error Summary (Unique only)
    UATHelper: Packaging (Windows (64-bit)):   LogInit: Display: -----------------------------------
    UATHelper: Packaging (Windows (64-bit)):   LogInit: Display: LogLinker: Error: Bad name index -1/534
    UATHelper: Packaging (Windows (64-bit)):   LogInit: Display:
    UATHelper: Packaging (Windows (64-bit)):   LogInit: Display: Failure - 1 error(s), 0 warning(s)
    UATHelper: Packaging (Windows (64-bit)):   LogInit: Display:
    UATHelper: Packaging (Windows (64-bit)):   
    UATHelper: Packaging (Windows (64-bit)):   Execution of commandlet took:  658.09 seconds
    UATHelper: Packaging (Windows (64-bit)): Took 724.0204116s to run UE4Editor-Cmd.exe, ExitCode=1
    UATHelper: Packaging (Windows (64-bit)): Cook failed. Deleting cooked data.
    UATHelper: Packaging (Windows (64-bit)): ERROR: Cook failed.
    UATHelper: Packaging (Windows (64-bit)):        (see C:\Users\John\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Program+Files+Epic+Games+UE_4.18\UAT_Log.txt for full exception trace)
    UATHelper: Packaging (Windows (64-bit)): AutomationTool exiting with ExitCode=25 (Error_UnknownCookFailure)
    UATHelper: Packaging (Windows (64-bit)): BUILD FAILED
    PackagingResults: Error: Unknown Cook Failure
    LogSavePackage: Save=11445.45ms

Can’t say that it fixed the problem since I had to delete some assets, but seeing where error was appearing in the log, I saw it was around some assets, levels and foliage, so I deleted the whole level files and it compiled.

I’m getting a similar error and can’t figure it out. What do you mean by ‘deleted the whole level files’? How could you do that without losing work?

I deleted some assets and levels I had recently changed. Unfortunatelly I lost them

For anyone show still has this issue. You can find the asset causing this by building the engine from source and adding breakpoints [here][1] and [here][2]. Loading the project then already triggers the breakpoints. In the stacktrace you can then find the call to UObject::Serialize(FArchive & Ar) which will reveal the name of the asset that is causing the issue:

In my case BT_Unit_Default. Which is a Behavior tree. I made a new Behavior tree and copied all the nodes into it and that fixed the issue. I guess it was some internal error in the behavior tree.