OpenRA/OpenRA · error · InvalidDataException
Actor {id} of unknown type {reference.Type.ToLowerInvariant(
Error message
Actor {id} of unknown type {reference.Type.ToLowerInvariant()} What it means
Thrown as an InvalidDataException by the EditorActorPreview constructor when the actor reference's Type (lowercased) is not present in world.Map.Rules.Actors. The editor loads a preview for each actor in a map; if the actor type string doesn't match any registered actor definition (case-insensitively via ToLowerInvariant), the lookup fails and the preview cannot be built.
Source
Thrown at OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs:68
SelectionBoxAnnotationRenderable selectionBox;
IActorPreview[] previews;
public EditorActorPreview(WorldRenderer worldRenderer, string id, ActorReference reference, PlayerReference owner)
{
ID = id;
this.reference = reference;
Owner = owner;
this.worldRenderer = worldRenderer;
if (!reference.Contains<FactionInit>())
reference.Add(new FactionInit(owner.Faction));
if (!reference.Contains<OwnerInit>())
reference.Add(new OwnerInit(owner.Name));
var world = worldRenderer.World;
if (!world.Map.Rules.Actors.TryGetValue(reference.Type.ToLowerInvariant(), out Info))
throw new InvalidDataException($"Actor {id} of unknown type {reference.Type.ToLowerInvariant()}");
GenerateFootprint();
UpdateFromCellChange();
tooltip = Info.TraitInfos<EditorOnlyTooltipInfo>().FirstOrDefault(info => info.EnabledByDefault) as TooltipInfoBase
?? Info.TraitInfos<TooltipInfo>().FirstOrDefault(info => info.EnabledByDefault);
DescriptiveName = tooltip != null ? tooltip.Name : Info.Name;
terrainRadarColorInfo = Info.TraitInfoOrDefault<RadarColorFromTerrainInfo>();
UpdateRadarColor();
}
public EditorActorPreview WithId(string id)
{
return new EditorActorPreview(worldRenderer, id, reference.Clone(), Owner);
}
View on GitHub (pinned to a520984d91)
Solutions
- Correct the actor type name in the map's actor definitions to match a registered actor.
- Restore or re-add the missing actor definition in the mod rules.
- Ensure the correct mod providing that actor is loaded when opening the map.
Example fix
// before (actor renamed from 'e1' to 'gi' in new mod version) Actor0: Type: e1 // after Actor0: Type: gi
Defensive patterns
Strategy: validation
Validate before calling
if (!world.Map.Rules.Actors.ContainsKey(reference.Type.ToLowerInvariant()))
throw new KeyNotFoundException($"Actor type '{reference.Type}' is not defined in the loaded rules."); Type guard
static bool IsKnownActor(Map map, string typeName) =>
map.Rules.Actors.ContainsKey(typeName.ToLowerInvariant()); Prevention
- Lint maps to verify every actor Type resolves in the loaded mod's rules.
- Re-lint maps after mod updates that rename or remove actors.
- Ensure the correct mod is loaded when opening maps in the editor.
When it happens
Trigger: A map's actor definitions reference an actor type that is not defined in the mod's rules (missing, renamed, or from an unloaded mod). reference.Type.ToLowerInvariant() is not a key in world.Map.Rules.Actors.
Common situations: Opening a map in the editor after a mod update renamed/removed an actor type; map referencing actors from a mod that is no longer loaded; typo in an actor type name in map YAML.
Related errors
- Actor {ID} must define Location or CenterPosition
- EditorActorLayer must not be defined on the world actor.
- No rules definition for unit {name}
- {debugName}, duplicate values found for the following keys:
- Actor type {name}: {e.Message}
AI-assisted analysis of OpenRA/OpenRA@a520984d91 (2026-08-13).
Data as JSON: /api/errors/1873b15a98e75ccd.
Report an issue: GitHub.