OpenRA/OpenRA · error · YamlException
ActorInfo("{Name}") failed to initialize because of the foll
Error message
ActorInfo("{Name}") failed to initialize because of the following:
Missing:
{missing}
Unresolved:
{unresolved} What it means
Thrown by TraitsInConstructOrder when, after topological resolution, some traits remain unresolved because their Requires<> dependencies cannot be satisfied by any other trait on the actor. The message lists missing (unsatisfiable) dependency types and unresolved traits with their dangling dependencies.
Source
Thrown at OpenRA.Game/GameRules/ActorInfo.cs:162
if (unresolved.Count != 0)
{
var exceptionString = "ActorInfo(\"" + Name + "\") failed to initialize because of the following:\n";
var missing = unresolved.SelectMany(u => u.Dependencies.Where(d => !source.Any(s => AreResolvable(d, s.Type)))).Distinct();
exceptionString += "Missing:\n";
foreach (var m in missing)
exceptionString += m + " \n";
exceptionString += "Unresolved:\n";
foreach (var u in unresolved)
{
var deps = u.Dependencies.Where(d => !resolved.Exists(r => r.Type == d));
var optDeps = u.OptionalDependencies.Where(d => !resolved.Exists(r => r.Type == d));
var allDeps = string.Join(", ", deps.Select(o => o.ToString()).Concat(optDeps.Select(o => $"[{o}]")));
exceptionString += $"{u.Type}: {{ {allDeps} }}\n";
}
throw new YamlException(exceptionString);
}
constructOrderCache = resolved.Select(r => r.Trait).ToArray();
return constructOrderCache;
}
public static IEnumerable<Type> PrerequisitesOf(TraitInfo info)
{
return info
.GetType()
.GetInterfaces()
.Where(t => t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Requires<>))
.Select(t => t.GetGenericArguments()[0]);
}
public static IEnumerable<Type> OptionalPrerequisitesOf(TraitInfo info)
{
return infoView on GitHub (pinned to a520984d91)
Solutions
- Add the missing dependency trait(s) named in the 'Missing' section of the message.
- Break any circular Requires<> dependencies flagged in the 'Unresolved' section.
- Reorder or remove traits that reference deleted dependency types.
- Use the linter to detect unmet trait prerequisites across all actors.
Example fix
# before - Render requires Health but Health missing
Actor:
RenderSprites:
# after
Actor:
Health:
HP: 100
RenderSprites: Defensive patterns
Strategy: validation
Validate before calling
// Pre-check trait prerequisites before construct order resolution
foreach (var trait in traits)
foreach (var req in ActorInfo.PrerequisitesOf(trait))
if (!traits.Any(t => req.IsAssignableFrom(t.GetType())))
// report the unmet prerequisite early Try / catch
try { actorInfo.TraitsInConstructOrder(); }
catch (YamlException ex) when (ex.Message.Contains("failed to initialize"))
{ /* parse Missing/Unresolved lists and add dependency traits */ } Prevention
- Always add the dependency trait when adding a Requires<> trait.
- Avoid circular Requires<> dependencies.
- Lint actors to detect unmet trait prerequisites.
When it happens
Trigger: Calling TraitsInConstructOrder on an ActorInfo where a trait declares a Requires<T> dependency for which no matching T trait is present (or a dependency cycle blocks resolution), leaving unresolved.Count > 0.
Common situations: Adding a trait that requires another (e.g. a Render trait requiring Health) without adding the dependency; renaming/removing a dependency trait; circular Requires<> dependencies; conditional traits that drop a required dependency.
Related errors
- Actor type {name}: {e.Message}
- Junk value `{my.Value}` on trait node {traitName}
- Trait name {traitName}: Required property missing: {fields}
- No rules definition for unit {name}
- More than one enabled ICreationActivity trait: {creationActi
AI-assisted analysis of OpenRA/OpenRA@a520984d91 (2026-08-13).
Data as JSON: /api/errors/8631ef3f5cc4163d.
Report an issue: GitHub.