# ErrRuntime\_WeakMapInvalidKey Causes Full Crash Of Game

**URL:** <https://forums.unrealengine.com/t/errruntime-weakmapinvalidkey-causes-full-crash-of-game/2038856>\
**Category:** Issues and Bug Reporting\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, bug-report, fortnite\
**Created:** [September 26, 2024, 5:30am UTC](https://forums.unrealengine.com/t/errruntime-weakmapinvalidkey-causes-full-crash-of-game/2038856 "2024-09-26T05:30:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Jimbohalo10](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jimbohalo10/32/961440_2.png) [@Jimbohalo10](https://forums.unrealengine.com/u/Jimbohalo10)\
**Post date:** [September 26, 2024, 6:17am UTC](https://forums.unrealengine.com/t/errruntime-weakmapinvalidkey-causes-full-crash-of-game/2038856/2 "2024-09-26T06:17:32Z")

</div>

hi @GraemeBB ,  
The way around this problem is to use the

```auto
<decides><transacts> 

```

In your function with an

```auto
if (conditions) { … }

```

```auto
#this sort of persistence code is replaced by the <decides><transacts> below
var PlayerProfileDataMap:weak_map(player, player_profile_data) = map{}

# This code checks the variable using rollback
IsPuzzleSolved()<decides><transacts> : void =
    CurrentState = PlayerProfileDataMap

 # succeeds if CurrentState is equal to PuzzleSolution, and fails if not
if (IsPuzzleSolved()) { … }

```

This is _ **template** _ code made from the Verse Persistence documentation where

Inside the block is the code for accessing the persistence weak\_map variable.

```auto
<decides><transacts> 

```

prevents the Verse runtime error

This code comes from  
[Verse Failure Contexts](https://dev.epicgames.com/documentation/en-us/uefn/verse-language-quick-reference#failurecontexts)

[Dealing with VersePersistence weak\_map](https://dev.epicgames.com/documentation/en-us/uefn/using-persistable-data-in-verse#reactingtoplayerjoiningyourisland)

Previously posted about this in another post  
[I want to know under what conditions this error occurs in Verse](https://forums.unrealengine.com/t/i-want-to-know-under-what-conditions-this-error-occurs-in-verse/1841137/6)

This another post that may be useful  
[What happens when verse runtime error occurs](https://forums.unrealengine.com/t/what-happens-when-verse-runtime-error-occurs/1863257)

---

_[View the full topic](https://forums.unrealengine.com/t/errruntime-weakmapinvalidkey-causes-full-crash-of-game/2038856)._
