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 info

View on GitHub (pinned to a520984d91)

Solutions

  1. Add the missing dependency trait(s) named in the 'Missing' section of the message.
  2. Break any circular Requires<> dependencies flagged in the 'Unresolved' section.
  3. Reorder or remove traits that reference deleted dependency types.
  4. 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

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


AI-assisted analysis of OpenRA/OpenRA@a520984d91 (2026-08-13). Data as JSON: /api/errors/8631ef3f5cc4163d. Report an issue: GitHub.