{"record":{"id":"1873b15a98e75ccd","repo":"OpenRA/OpenRA","slug":"actor-id-of-unknown-type-reference-type-tolower","errorCode":null,"errorMessage":"Actor {id} of unknown type {reference.Type.ToLowerInvariant()}","messagePattern":"Actor (.+?) of unknown type (.+?)","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs","lineNumber":68,"sourceCode":"\t\tSelectionBoxAnnotationRenderable selectionBox;\n\t\tIActorPreview[] previews;\n\n\t\tpublic EditorActorPreview(WorldRenderer worldRenderer, string id, ActorReference reference, PlayerReference owner)\n\t\t{\n\t\t\tID = id;\n\t\t\tthis.reference = reference;\n\t\t\tOwner = owner;\n\t\t\tthis.worldRenderer = worldRenderer;\n\n\t\t\tif (!reference.Contains<FactionInit>())\n\t\t\t\treference.Add(new FactionInit(owner.Faction));\n\n\t\t\tif (!reference.Contains<OwnerInit>())\n\t\t\t\treference.Add(new OwnerInit(owner.Name));\n\n\t\t\tvar world = worldRenderer.World;\n\t\t\tif (!world.Map.Rules.Actors.TryGetValue(reference.Type.ToLowerInvariant(), out Info))\n\t\t\t\tthrow new InvalidDataException($\"Actor {id} of unknown type {reference.Type.ToLowerInvariant()}\");\n\n\t\t\tGenerateFootprint();\n\t\t\tUpdateFromCellChange();\n\n\t\t\ttooltip = Info.TraitInfos<EditorOnlyTooltipInfo>().FirstOrDefault(info => info.EnabledByDefault) as TooltipInfoBase\n\t\t\t\t?? Info.TraitInfos<TooltipInfo>().FirstOrDefault(info => info.EnabledByDefault);\n\n\t\t\tDescriptiveName = tooltip != null ? tooltip.Name : Info.Name;\n\n\t\t\tterrainRadarColorInfo = Info.TraitInfoOrDefault<RadarColorFromTerrainInfo>();\n\t\t\tUpdateRadarColor();\n\t\t}\n\n\t\tpublic EditorActorPreview WithId(string id)\n\t\t{\n\t\t\treturn new EditorActorPreview(worldRenderer, id, reference.Clone(), Owner);\n\t\t}\n","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/OpenRA/OpenRA/blob/a520984d91eda9de48a62b1d15c1e3bad0d4fb1a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs#L50-L86","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (actor renamed from 'e1' to 'gi' in new mod version)\nActor0:\n\tType: e1\n// after\nActor0:\n\tType: gi","handlingStrategy":"validation","validationCode":"if (!world.Map.Rules.Actors.ContainsKey(reference.Type.ToLowerInvariant()))\n    throw new KeyNotFoundException($\"Actor type '{reference.Type}' is not defined in the loaded rules.\");","typeGuard":"static bool IsKnownActor(Map map, string typeName) =>\n    map.Rules.Actors.ContainsKey(typeName.ToLowerInvariant());","tryCatchPattern":null,"preventionTips":["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."],"tags":["editor","actors","rules","config-validation","openra"],"backgroundTag":null,"analyzedSha":"a520984d91eda9de48a62b1d15c1e3bad0d4fb1a","analyzedAt":"2026-08-13T15:30:14.787Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}