The server console error "[ERRO] resolve: can't resolve "robust.shared.gameobjects.metadatacomponent" on entity" occurs because the round persistence system was calling MetaData(entityUid).EntityName on entities that might be:
- Being deleted during round transitions
- Already deleted but still referenced
- Missing the MetaDataComponent
- In an invalid state during entity lifecycle changes
The persistence system runs during round restarts when entities are being created, deleted, and modified rapidly. Accessing components without validation during this period causes resolution failures.
Before (Unsafe):
var stationName = MetaData(stationUid).EntityName;After (Safe):
if (TryComp<MetaDataComponent>(stationUid, out var stationMeta))
var stationName = stationMeta.EntityName;
else
var stationName = stationUid.ToString(); // FallbackAdded validation checks:
if (!EntityExists(entityUid) || TerminatingOrDeleted(entityUid) || !TryComp<MetaDataComponent>(entityUid, out var meta))
{
_sawmill.Warning($"Skipping invalid entity {entityUid}");
return; // or continue;
}Created GetSafeEntityName(EntityUid) helper method for consistent safe access.
Content.Server\_HL\RoundPersistence\Systems\RoundPersistenceSystem.csContent.Server\_HL\RoundPersistence\Systems\PlayerPaymentPersistenceSystem.cs
- Eliminates MetaDataComponent resolution errors
- Prevents crashes during round transitions
- Adds graceful degradation when entities are invalid
- Maintains system functionality while improving stability
- Monitor server console for the MetaDataComponent error
- Perform round restarts and observe logs
- Verify persistence system still functions correctly
- Check that ships and player data are preserved across rounds
The fixes maintain all existing functionality while preventing the component resolution errors that occur during entity lifecycle changes.