AI Behavior Tree - Pasting caused Access violation - code c0000005 (first/second chance not available)

< AI Behavior Tree - Pasting caused Access violation - code c0000005 (first/second chance not available) >


I was creating an AI and all was well until I noticed an anomaly while pasting inside the behavior tree editor. I copied and pasted a sub-tree within the editor and could not link it to the main structure. Since compiling successfully saves the assets by default, I thought it just needed a restart. I proceeded to compile the project, thus saving the tree, and reloaded UE4 4.11. I hit play before going back into editing and the AI seemed to be running the sub-tree I pasted and didn’t sucessfully link into the main behavior tree. Like any debugger, I try to load up the behavior tree to check things out and I get my first crash with UE4. Below is the crash report has told me. I was wondering if there is any way to remove the sub-tree that pasted incorrectly outside of UE4 - I’ve had no luck inside the engine as the editor crashes before loading the structure for editing; but the AI seems to be running in-game oddly (not behaving like intended however).

I’ve exported the tree as a text file but there’s no way to re-import. The other issue, pardon my ignorance, is I have no idea where to look for my pasting error… Any help would be appreciated.

UE4 Crash Report

UE4 Exported Copy of Tree

I forgot to mention the things I’ve tried so far:

  • Migrating the Asset to 4.11 and 4.12
  • Opening it in wordpad (just symbols, no code to be seen)
  • Rebuild and Playing (the pasted part seems to be running but incorrectly)
  • Elevating UAC (Worth a try)
  • Restarting the computer? (didn’t work)
  • Googling for the exact error to see what other people did (no similar cases with pasting causing the problem)
  • Binging the same thing (got desparate)
  • Posting here to see if the brilliant minds can see what I cannot

Hey CipherKey,

What exactly did you paste into the behavior tree? Just to clarify, the nodes you were attempting to paste were from another behavior tree?

Have you been able to reproduce this in a clean project? If so, could you please provide repro steps so we can reproduce it on our end?

Hi Sean,

I copied and pasted within the same behavior tree, nothing was generated/obtained from an external source. It was a sequence for moving the AI which modified the move speed depending on distance and updated a waypoint vector within the blackboard while moving towards it. There is two functional versions of this sequence for my two primary NPC types which only differ by setting different speeds for different distances from the waypoint depending on the NPC type. I added a third NPC type and copied and pasted the terminal nodes that update the waypoint and move to it, setting the speed appropriately. These terminal nodes were linked to a sequence. I tried to link the sequence node to the third branch that my new NPC type should perform and the nodes would not link (simple parallel background task to the sequence node I pasted; that sequence node is connected to my other tasks which are functional in my other two enemy type branches). I was frustrated that what I pasted didn’t link so I decided a restart was in order. You know the rest of the story.

It may be difficult to reproduce as it might’ve been a rare clipboard blip in the memory which altered the hidden references and identifiers of the nodes from the end user. Upon pasting the corrupt subtree, the engine didn’t link the nodes visually due to incompatibility? But somewhere in the background, it may’ve linked partially?

Anywho, the tree seems to be running the background tasks of the pasted subtree, but the main task doesn’t run. The main task runs on the other two NPC types (attack the enemy that holds aggro priority) which may imply that the main task isn’t the problem.

Because I can’t open it up in the editor, there’s no real way to troubleshoot… Unless there’s some magic workaround that allows you to delete the nodes associated with the last enemy type altogether?


If you look in your project’s Saved->Backups folder, do you see an older copy of the Behavior Tree? Occasionally the editor will save a backup of assets, which you can then try to reimport into the project.

Let me know if that helps at all. If not, we’ll continue looking for some further suggestions to get your issue resolved.


Unfortunately, it doesn’t seem like there’s a back-up. I created a new semi-functional replacement to continue development so I guess it’s probably more efficient to give up on recovery of the old behavior tree. It’s not going to be easy to reproduce as it seems to be a rare occurance (the access violation bug itself as well). I’ll be starting a back-up regime as a counter measure. If it does occur again, I’ll submit file histories to see if we can pin-point the problem that occurred.