# Unhandled exception error while engulfing and getting hurt in multicellular stage

**URL:** <https://community.revolutionarygamesstudio.com/t/unhandled-exception-error-while-engulfing-and-getting-hurt-in-multicellular-stage/7161>\
**Category:** Bug Reports\
**Tags:** crash\
**Created:** [January 7, 2024, 7:45pm UTC](https://community.revolutionarygamesstudio.com/t/unhandled-exception-error-while-engulfing-and-getting-hurt-in-multicellular-stage/7161 "2024-01-07T19:45:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dalmond](https://thrivecommunity-cdn.b-cdn.net/letter_avatar_proxy/v4/letter/d/a9a28c/32.png) [@dalmond](https://community.revolutionarygamesstudio.com/u/dalmond)\
**Post date:** [January 7, 2024, 7:45pm UTC](https://community.revolutionarygamesstudio.com/t/unhandled-exception-error-while-engulfing-and-getting-hurt-in-multicellular-stage/7161/1 "2024-01-07T19:45:40Z")

</div>

I’m playing current verson 0.6.4.1 Had already 6 cells as a structure, was in the procces of growing the second one, tried to engulf something while getting pierced by another cell when the game crashed, I don’t think i had low enough health to die but it may be related, followed instructions to report the error here  
Log

> **[Playing Steam VersionThrive is starting. Log output (due to buffering this is...](https://pastebin.com/Ua5DK3JD)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

Crash report

> **[Thrive has crashed at 2024-01-07T19:31:32.5509543Z (crash happened immediately...](https://pastebin.com/syMpzFRY)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

---

<div class="post-metadata">

**Author:** ![hhyyrylainen](https://thrivecommunity-cdn.b-cdn.net/user_avatar/community.revolutionarygamesstudio.com/hhyyrylainen/32/32_2.png) [@hhyyrylainen](https://community.revolutionarygamesstudio.com/u/hhyyrylainen)\
**Post date:** [January 8, 2024, 8:33am UTC](https://community.revolutionarygamesstudio.com/t/unhandled-exception-error-while-engulfing-and-getting-hurt-in-multicellular-stage/7161/2 "2024-01-08T08:33:09Z")

</div>

Thanks for the report. I had not seen this before.

Here’s the crash from the log:

```auto
ERROR: System.IndexOutOfRangeException: Index was outside the bounds of the array.
ERROR: 
ERROR: at Components.MicrobeColonyHelpers.GetMicrobeFromSubShape (Components.MicrobeColony& colony, Components.MicrobePhysicsExtraData& physicsExtraData, System.UInt32 subShape, DefaultEcs.Entity& microbe) [0x0001f] in <301006abc0b74455808ece2c77496c9b>:0 
ERROR: 
ERROR: at Systems.PilusDamageSystem.Update (System.Single delta, DefaultEcs.Entity& entity) [0x000b8] in <301006abc0b74455808ece2c77496c9b>:0 
ERROR: 
ERROR: at DefaultEcs.System.AEntitySetSystem`1[T].Update (T state, System.ReadOnlySpan`1[T] entities) [0x0000f] in <71cea9262b2d4f47b57b59fbd6ae9b26>:0 
ERROR: 
ERROR: at DefaultEcs.System.AEntitySetSystem`1[T].Update (T state) [0x000c3] in <71cea9262b2d4f47b57b59fbd6ae9b26>:0 
ERROR: 
ERROR: at MicrobeWorldSimulation.OnProcessFixedLogic (System.Single delta) [0x00150] in <301006abc0b74455808ece2c77496c9b>:0 
ERROR: 
ERROR: at WorldSimulation.ProcessLogic (System.Single delta) [0x00092] in <301006abc0b74455808ece2c77496c9b>:0 
ERROR: 
ERROR: at WorldSimulation.ProcessAll (System.Single delta) [0x00000] in <301006abc0b74455808ece2c77496c9b>:0 
ERROR: 
ERROR: at MicrobeStage._Process (System.Single delta) [0x00083] in <301006abc0b74455808ece2c77496c9b>:0 

```

Looking at the code I saw that I was already trying to prevent crashing due to collision index data being out of sync (it takes one extra frame for it to be updated after a colony changes shape). But I noticed that I had accidentally written `index > length` when I should have written `index >= length`. Here’s the PR that should fix the problem:

> <https://github.com/Revolutionary-Games/Thrive/pull/4779>
>
> \*\*Brief Description of What This PR Does\*\*
> 
> Should fix a crash caused by a typ…o (missing \`=\` in index in range check).
> 
> \*\*Related Issues\*\*
> 
> \<!-- List all issues this PR closes here with the closes syntax: 
> https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
> If this is not related to an issue, it should be described in more detail why this PR is needed here instead.
> \--\>
> https://community.revolutionarygamesstudio.com/t/unhandled-exception-error-while-engulfing-and-getting-hurt-in-multicellular-stage/7161
> 
> \*\*Progress Checklist\*\*
> 
> Note: before starting this checklist the PR should be marked as non-draft.
> 
> \- \[x\] PR author has checked that this PR works as intended and doesn't
> break existing features:
> https://wiki.revolutionarygamesstudio.com/wiki/Testing\_Checklist
> (this is important as to not waste the time of Thrive team
> members reviewing this PR)
> \- \[\] Initial code review passed (this and further items should not be checked by the PR author)
> \- \[\] Functionality is confirmed working by another person (see above checklist link)
> \- \[\] Final code review is passed and code conforms to the 
> \[styleguide\](https://github.com/Revolutionary-Games/Thrive/blob/master/doc/style\_guide.md).
> 
> Before merging all CI jobs should finish on this PR without errors, if
> there are automatically detected style issues they should be fixed by
> the PR author. Merging must follow our
> \[styleguide\](https://github.com/Revolutionary-Games/Thrive/blob/master/doc/style\_guide.md#git).
