initERacksActive throws NRE on OnStart when IVA placeholder mode is active (KSP Community Fixes) #54

Open
opened 2026-06-15 17:33:31 +02:00 by liltine · 1 comment
liltine commented 2026-06-15 17:33:31 +02:00 (Migrated from github.com)

Environment:

OMS/NEOS 0.10.0
KSP 1.12.5
KSP Community Fixes installed, with IVA handling set to "placeholder" mode

Summary:

With KSPCF's IVA placeholder mode enabled, both MPL_Module and MSL_Module throw a NullReferenceException in initERacksActive() during OnStart. Because the exception aborts OnStart, the labs never finish initializing and the equipment install action is never registered — equipment carriers dock/sit on the same vessel with correct equipment, but no install option ever appears on the lab or carrier.
Root cause:

initERacksActive() guards only on part.internalModel != null. In placeholder IVA mode the internal model object exists (non-null) but lacks the expected mesh hierarchy, so:

csharpGameObject labIVA = part.internalModel.gameObject.transform.GetChild(0).GetChild(0).gameObject;
if (labIVA.GetComponent<MeshFilter>().name == "Lab1IVA")  // GetComponent returns null → .name throws
GetComponent<MeshFilter>() returns null and .name throws.

Stack trace:

[EXC 17:07:51.072] NullReferenceException: Object reference not set to an instance of an object
	NE_Science.MPL_Module.initERacksActive () (at <a6ea64e79c044aaca2123ac101d1d50c>:0)
	NE_Science.MPL_Module.updateLabStatus () (at <a6ea64e79c044aaca2123ac101d1d50c>:0)
	NE_Science.Lab.updateStatus () (at <a6ea64e79c044aaca2123ac101d1d50c>:0)
	NE_Science.Lab+<updateState>d__30.MoveNext () (at <a6ea64e79c044aaca2123ac101d1d50c>:0)
	UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <12e76cd50cc64cf19e759e981cb725af>:0)
	UnityEngine.DebugLogHandler:LogException(Exception, Object)
	ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
	UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
	NE_Science.Lab:OnStart(StartState)
	NE_Science.MPL_Module:OnStart(StartState)
	Part:ModulesOnStart()
	<Start>d__323:Part+<Start>d__323.MoveNext_Patch0(<Start>d__323)
	UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
[ERR 17:07:51.073] Module MPL_Module threw during OnStart: System.NullReferenceException: Object reference not set to an instance of an object
  at NE_Science.MPL_Module.initERacksActive () [0x00043] in <a6ea64e79c044aaca2123ac101d1d50c>:0 
  at NE_Science.MPL_Module.OnStart (PartModule+StartState state) [0x0000c] in <a6ea64e79c044aaca2123ac101d1d50c>:0 
  at Part.ModulesOnStart () [0x00120] in <4b449f2841f84227adfaad3149c8fdba>:0 

[LOG 17:07:51.073] -INFO- Tac.LifeSupportModule[FFDB07E2][317.78]: OnStart: PreLaunch, Landed
[EXC 17:07:51.074] NullReferenceException: Object reference not set to an instance of an object
	NE_Science.MSL_Module.initERacksActive () (at <a6ea64e79c044aaca2123ac101d1d50c>:0)
	NE_Science.MSL_Module.updateLabStatus () (at <a6ea64e79c044aaca2123ac101d1d50c>:0)
	NE_Science.Lab.updateStatus () (at <a6ea64e79c044aaca2123ac101d1d50c>:0)
	NE_Science.Lab+<updateState>d__30.MoveNext () (at <a6ea64e79c044aaca2123ac101d1d50c>:0)
	UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <12e76cd50cc64cf19e759e981cb725af>:0)
	UnityEngine.DebugLogHandler:LogException(Exception, Object)
	ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
	UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
	NE_Science.Lab:OnStart(StartState)
	NE_Science.MSL_Module:OnStart(StartState)
	Part:ModulesOnStart()
	<Start>d__323:Part+<Start>d__323.MoveNext_Patch0(<Start>d__323)
	UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
[ERR 17:07:51.074] Module MSL_Module threw during OnStart: System.NullReferenceException: Object reference not set to an instance of an object
  at NE_Science.MSL_Module.initERacksActive () [0x00043] in <a6ea64e79c044aaca2123ac101d1d50c>:0 
  at NE_Science.MSL_Module.OnStart (PartModule+StartState state) [0x0000c] in <a6ea64e79c044aaca2123ac101d1d50c>:0 
  at Part.ModulesOnStart () [0x00120] in <4b449f2841f84227adfaad3149c8fdba>:0 

[LOG 17:07:51.075] -INFO- Tac.LifeSupportModule[FFDB07C8][317.78]: OnStart: PreLaunch, Landed

Repro:

Install KSP Community Fixes, set IVA mode to placeholder.
Place an MPL-600 or MSL-1000 on the pad (crewed, with an equipment carrier on the same vessel).
Observe the NRE in KSP.log during flight load; no install action appears on the lab.

Workaround:

Re-enable full IVA loading (disable placeholder mode). Install action returns.

Environment: OMS/NEOS 0.10.0 KSP 1.12.5 KSP Community Fixes installed, with IVA handling set to "placeholder" mode Summary: With KSPCF's IVA placeholder mode enabled, both MPL_Module and MSL_Module throw a NullReferenceException in initERacksActive() during OnStart. Because the exception aborts OnStart, the labs never finish initializing and the equipment install action is never registered — equipment carriers dock/sit on the same vessel with correct equipment, but no install option ever appears on the lab or carrier. Root cause: initERacksActive() guards only on part.internalModel != null. In placeholder IVA mode the internal model object exists (non-null) but lacks the expected mesh hierarchy, so: ```c# csharpGameObject labIVA = part.internalModel.gameObject.transform.GetChild(0).GetChild(0).gameObject; if (labIVA.GetComponent<MeshFilter>().name == "Lab1IVA") // GetComponent returns null → .name throws GetComponent<MeshFilter>() returns null and .name throws. ``` Stack trace: ``` [EXC 17:07:51.072] NullReferenceException: Object reference not set to an instance of an object NE_Science.MPL_Module.initERacksActive () (at <a6ea64e79c044aaca2123ac101d1d50c>:0) NE_Science.MPL_Module.updateLabStatus () (at <a6ea64e79c044aaca2123ac101d1d50c>:0) NE_Science.Lab.updateStatus () (at <a6ea64e79c044aaca2123ac101d1d50c>:0) NE_Science.Lab+<updateState>d__30.MoveNext () (at <a6ea64e79c044aaca2123ac101d1d50c>:0) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <12e76cd50cc64cf19e759e981cb725af>:0) UnityEngine.DebugLogHandler:LogException(Exception, Object) ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) NE_Science.Lab:OnStart(StartState) NE_Science.MPL_Module:OnStart(StartState) Part:ModulesOnStart() <Start>d__323:Part+<Start>d__323.MoveNext_Patch0(<Start>d__323) UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) [ERR 17:07:51.073] Module MPL_Module threw during OnStart: System.NullReferenceException: Object reference not set to an instance of an object at NE_Science.MPL_Module.initERacksActive () [0x00043] in <a6ea64e79c044aaca2123ac101d1d50c>:0 at NE_Science.MPL_Module.OnStart (PartModule+StartState state) [0x0000c] in <a6ea64e79c044aaca2123ac101d1d50c>:0 at Part.ModulesOnStart () [0x00120] in <4b449f2841f84227adfaad3149c8fdba>:0 [LOG 17:07:51.073] -INFO- Tac.LifeSupportModule[FFDB07E2][317.78]: OnStart: PreLaunch, Landed [EXC 17:07:51.074] NullReferenceException: Object reference not set to an instance of an object NE_Science.MSL_Module.initERacksActive () (at <a6ea64e79c044aaca2123ac101d1d50c>:0) NE_Science.MSL_Module.updateLabStatus () (at <a6ea64e79c044aaca2123ac101d1d50c>:0) NE_Science.Lab.updateStatus () (at <a6ea64e79c044aaca2123ac101d1d50c>:0) NE_Science.Lab+<updateState>d__30.MoveNext () (at <a6ea64e79c044aaca2123ac101d1d50c>:0) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <12e76cd50cc64cf19e759e981cb725af>:0) UnityEngine.DebugLogHandler:LogException(Exception, Object) ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) NE_Science.Lab:OnStart(StartState) NE_Science.MSL_Module:OnStart(StartState) Part:ModulesOnStart() <Start>d__323:Part+<Start>d__323.MoveNext_Patch0(<Start>d__323) UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) [ERR 17:07:51.074] Module MSL_Module threw during OnStart: System.NullReferenceException: Object reference not set to an instance of an object at NE_Science.MSL_Module.initERacksActive () [0x00043] in <a6ea64e79c044aaca2123ac101d1d50c>:0 at NE_Science.MSL_Module.OnStart (PartModule+StartState state) [0x0000c] in <a6ea64e79c044aaca2123ac101d1d50c>:0 at Part.ModulesOnStart () [0x00120] in <4b449f2841f84227adfaad3149c8fdba>:0 [LOG 17:07:51.075] -INFO- Tac.LifeSupportModule[FFDB07C8][317.78]: OnStart: PreLaunch, Landed ``` Repro: Install KSP Community Fixes, set IVA mode to placeholder. Place an MPL-600 or MSL-1000 on the pad (crewed, with an equipment carrier on the same vessel). Observe the NRE in KSP.log during flight load; no install action appears on the lab. Workaround: Re-enable full IVA loading (disable placeholder mode). Install action returns.
mwerle commented 2026-06-27 12:20:27 +02:00 (Migrated from github.com)

"In placeholder IVA mode the internal model object exists (non-null) but lacks the expected mesh hierarchy, so:"

In this case I suspect that the entire mod will require a significant rewrite, since it relies heavily on the IVA being "correct". When lab equipment and experiments are installed or removed, various IVA components are enabled or disabled, animations started/stopped, etc etc. It's pretty intertwined and embedded.

I'm sorry, but this is going to be pretty low on my priorities list - I can't really be expected to implement workarounds for other mods actively breaking this mod..

That said, thank you for the detailed report; if I do end up with some significant spare time, I will take a look. Alternatively if the fix isn't as complicated and involved as I suspect it will be, I'll happily accept a PR. But if the PR is "big", then I'm sorry, I'll likely be unable to spend the time to perform a detailed review and accept it either.

"In placeholder IVA mode the internal model object exists (non-null) but lacks the expected mesh hierarchy, so:" In this case I suspect that the entire mod will require a significant rewrite, since it relies heavily on the IVA being "correct". When lab equipment and experiments are installed or removed, various IVA components are enabled or disabled, animations started/stopped, etc etc. It's pretty intertwined and embedded. I'm sorry, but this is going to be pretty low on my priorities list - I can't really be expected to implement workarounds for other mods actively breaking this mod.. That said, thank you for the detailed report; if I do end up with some significant spare time, I will take a look. Alternatively if the fix isn't as complicated and involved as I suspect it will be, I'll happily accept a PR. But if the PR is "big", then I'm sorry, I'll likely be unable to spend the time to perform a detailed review and accept it either.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ksp/NehemiahEngineeringOrbitalScience#54
No description provided.