Loading SAVE fails if Casting Fuctional Block with LightingComponent to Nonfunctional due to mod rem

Robert Lindberg shared this bug 18 hours ago
Submitted

## Issue description

I made a mod that casts some decorative blocks into functional variants (Assembler):

* Planter/LargeBlockPlanters -> Assembler/LargeBlockPlanters

* Kitchen/LargeBlockKitchen -> Assembler/LargeBlockKitchen


The blocks revert back if mod is removed without issue, unless I have also added a LightingComponent. If I do add that and the mod is removed, loading the SAVE fails claiming corruption.

Question: Is there a way to have a light added to a block that can revert to nonfunctional, without causing loading SAVE to fail?


I have attached a test SAVE with a couple of Planters casted into Assemblers (with LightingComponent). As the mod was removed, loading will fail (log included).


## Log (excerpt):

`

2026-05-18 21:46:02.237 - Thread: 1 -> Exceptions during entities load:

2026-05-18 21:46:02.237 - Thread: 1 -> Exception occurred: ParallelTasks.TaskException: An exception(s) was thrown while executing a task.

at ParallelTasks.WorkItem.ThrowExceptionsInternal(Int32 runId)

at ParallelTasks.Task.WaitOrExecute(Boolean blocking)

at ParallelTasks.Parallel.For(Int32 startInclusive, Int32 endExclusive, Action`1 body, Int32 stride, WorkPriority priority, Nullable`1 options, Boolean blocking)

at Sandbox.Game.Entities.MyEntities.Load(List`1 objectBuilders, Nullable`1& errorMessage)

Task exception, inner exception 0:

System.InvalidCastException: Unable to cast object of type 'Sandbox.Game.Entities.MyPlanter' to type 'Sandbox.Game.Entities.Cube.MyFunctionalBlock'.

at SpaceEngineers.Game.EntityComponents.Blocks.MyLightingComponent.UnsubscribeFromGridAndLightingLogic()

at SpaceEngineers.Game.EntityComponents.Blocks.MyLightingComponent.OnBeforeRemovedFromContainer()

at VRage.Game.Components.MyComponentBase.SetContainer(IMyComponentContainer container)

at VRage.Game.Components.MyComponentContainer.RemoveComponentInternal(Type t, MyComponentBase c)

at VRage.Game.Components.MyComponentContainer.OnAddedToScene()

at VRage.Game.Entity.MyEntity.OnAddedToScene(Object source)

at Sandbox.Game.Entities.MyCubeBlock.OnAddedToScene(Object source)

at VRage.Game.Entity.MyEntity.OnAddedToScene(Object source)

at Sandbox.Game.Entities.MyCubeGrid.OnAddedToScene(Object source)

at Sandbox.Game.Entities.MyEntities.Add(MyEntity entity, Boolean insertIntoScene)

at Sandbox.Game.Entities.MyEntities.InitEntityData.OnEntityInitialized()

at Sandbox.Game.Entities.MyEntities.<>c__DisplayClass179_1.<Load>b__1(Int32 i)

at ParallelTasks.ForLoopWork.DoWork(WorkData workData)

at ParallelTasks.WorkItem.DoWork(Int32 expectedID)


2026-05-18 21:46:02.238 - Thread: 1 -> Error: Error during loading session:Sandbox.Game.Screens.MyLoadingException: An error occurred while loading the world.

The world may be corrupted and can't be loaded.

Please, restart the game and try again.

at Sandbox.Game.World.MySession.ShowLoadingError(Boolean lobbyFailed, MyLobbyStatusCode statusCode, Nullable`1 errorMessage)

at Sandbox.Game.World.MySession.LoadWorld(MyObjectBuilder_Checkpoint checkpoint, MyObjectBuilder_Sector sector)

at Sandbox.Game.World.MySession.Load(String sessionPath, MyObjectBuilder_Checkpoint checkpoint, UInt64 checkpointSizeInBytes, Boolean saveLastStates, Boolean allowXml)

2026-05-18 21:46:02.239 - Thread: 1 -> ERROR: Loading screen failed

2026-05-18 21:46:02.240 - Thread: 1 -> Exception occurred: Sandbox.Game.Screens.MyLoadingException: An error occurred while loading the world.

The world may be corrupted and can't be loaded.

Please, restart the game and try again.

at Sandbox.Game.World.MySession.ShowLoadingError(Boolean lobbyFailed, MyLobbyStatusCode statusCode, Nullable`1 errorMessage)

at Sandbox.Game.World.MySession.LoadWorld(MyObjectBuilder_Checkpoint checkpoint, MyObjectBuilder_Sector sector)

at Sandbox.Game.World.MySession.Load(String sessionPath, MyObjectBuilder_Checkpoint checkpoint, UInt64 checkpointSizeInBytes, Boolean saveLastStates, Boolean allowXml)

at Sandbox.Game.World.MySessionLoader.<>c__DisplayClass20_0.<LoadSingleplayerSessionInternal>b__7()

at System.DelegateExtensions.InvokeIfNotNull(Action handler)

at Sandbox.Game.Gui.MyGuiScreenLoading.RunLoad()

2026-05-18 21:46:02.240 - Thread: 1 -> MyGuiScreenGamePlay.UnloadData - START

`


## Save Data (excerpt):

`

<MyObjectBuilder_CubeBlock xsi:type="MyObjectBuilder_Assembler">

<SubtypeName>LargeBlockPlanters</SubtypeName>

<EntityId>101808985496185335</EntityId>

<Name>101808985496185335</Name>

<Min x="3" y="8" z="6" />

<ColorMaskHSV x="0" y="-0.8" z="0.2" />

<BuiltBy>144115188075855904</BuiltBy>

<ComponentContainer>

<Components>

<ComponentData>

<TypeId>MyLightingComponent</TypeId>

<Component xsi:type="MyObjectBuilder_LightingComponent">

<Radius>1.8</Radius>

<ReflectorRadius>120</ReflectorRadius>

<Falloff>1.3</Falloff>

<Intensity>0.5</Intensity>

<BlinkIntervalSeconds>0</BlinkIntervalSeconds>

<BlinkLength>10</BlinkLength>

<BlinkOffset>0</BlinkOffset>

<Offset>0.5</Offset>

</Component>

</ComponentData>

<ComponentData>

<TypeId>MyInventoryBase</TypeId>

<Component xsi:type="MyObjectBuilder_InventoryAggregate">

<InventoryId>Inventory</InventoryId>

<CanPutItems>true</CanPutItems>

<Inventories>

<MyObjectBuilder_InventoryBase xsi:type="MyObjectBuilder_Inventory">

<CanPutItems>true</CanPutItems>

<Items />

<nextItemId>0</nextItemId>

<Volume>0.1</Volume>

<Mass>9223372036854.775807</Mass>

<MaxItemCount>2147483647</MaxItemCount>

<Size xsi:nil="true" />

<InventoryFlags>CanReceive</InventoryFlags>

<RemoveEntityOnEmpty>false</RemoveEntityOnEmpty>

</MyObjectBuilder_InventoryBase>

<MyObjectBuilder_InventoryBase xsi:type="MyObjectBuilder_Inventory">

<CanPutItems>true</CanPutItems>

<Items />

<nextItemId>0</nextItemId>

<Volume>0.1</Volume>

<Mass>9223372036854.775807</Mass>

<MaxItemCount>2147483647</MaxItemCount>

<Size xsi:nil="true" />

<InventoryFlags>CanSend</InventoryFlags>

<RemoveEntityOnEmpty>false</RemoveEntityOnEmpty>

</MyObjectBuilder_InventoryBase>

</Inventories>

</Component>

</ComponentData>

<ComponentData>

<TypeId>MyTimerComponent</TypeId>

<Component xsi:type="MyObjectBuilder_TimerComponent">

<Repeat>true</Repeat>

<TimeToEvent>0</TimeToEvent>

<SetTimeMinutes>0</SetTimeMinutes>

<TimerEnabled>true</TimerEnabled>

<RemoveEntityOnTimer>false</RemoveEntityOnTimer>

<TimerType>Frame10</TimerType>

<FramesFromLastTrigger>50</FramesFromLastTrigger>

<TimerTickInFrames>300</TimerTickInFrames>

<IsSessionUpdateEnabled>false</IsSessionUpdateEnabled>

</Component>

</ComponentData>

</Components>

</ComponentContainer>

<ShowOnHUD>false</ShowOnHUD>

<ShowInTerminal>true</ShowInTerminal>

<ShowInToolbarConfig>true</ShowInToolbarConfig>

<ShowInInventory>true</ShowInInventory>

<NumberInGrid>1</NumberInGrid>

<Enabled>true</Enabled>

<CurrentProgress>0</CurrentProgress>

<DisassembleEnabled>false</DisassembleEnabled>

<RepeatAssembleEnabled>false</RepeatAssembleEnabled>

<RepeatDisassembleEnabled>false</RepeatDisassembleEnabled>

<SlaveEnabled>false</SlaveEnabled>

</MyObjectBuilder_CubeBlock>

`

Replies (1)

photo
0

Hello!

Thank you for contacting us.

As this report describes a specific and reproducible situation, we will move your ticket to our support forum, where our QA team can investigate the issue further.

Kind Regards,

Keen Software House

Leave a Comment
 
Attach a file
You can't vote. Please authorize!