OpenRA/OpenRA · error · YamlException

Weapons Ruleset does not contain an entry '{weaponToLower}'

Error message

Weapons Ruleset does not contain an entry '{weaponToLower}'

What it means

BridgeInfo.RulesetLoaded (Bridge.cs:65) resolves DemolishWeapon against the loaded weapons ruleset (case-insensitive) and throws if it is absent. The bridge must reference a real, registered weapon so its destruction effect can be looked up at runtime.

Source

Thrown at OpenRA.Mods.Common/Traits/Buildings/Bridge.cs:65

		public WeaponInfo DemolishWeaponInfo { get; private set; }

		[Desc("Types of damage that this bridge causes to units over/in path of it while being destroyed/repaired. Leave empty for no damage types.")]
		public readonly BitSet<DamageType> DamageTypes = default;

		public override object Create(ActorInitializer init) { return new Bridge(init.Self, this); }

		public void RulesetLoaded(Ruleset rules, ActorInfo ai)
		{
			if (!rules.Actors[SystemActors.World].HasTraitInfo<ITiledTerrainRendererInfo>())
				throw new YamlException("Bridge requires a tile-based terrain renderer.");

			if (string.IsNullOrEmpty(DemolishWeapon))
				throw new YamlException("A value for DemolishWeapon of a Bridge trait is missing.");

			var weaponToLower = DemolishWeapon.ToLowerInvariant();
			if (!rules.Weapons.TryGetValue(weaponToLower, out var weapon))
				throw new YamlException($"Weapons Ruleset does not contain an entry '{weaponToLower}'");

			DemolishWeaponInfo = weapon;
		}

		public IEnumerable<(ushort Template, int Health)> Templates
		{
			get
			{
				if (Template != 0)
					yield return (Template, 100);

				if (DamagedTemplate != 0)
					yield return (DamagedTemplate, 49);

				if (DestroyedTemplate != 0)
					yield return (DestroyedTemplate, 0);

				if (DestroyedPlusNorthTemplate != 0)

View on GitHub (pinned to a520984d91)

Solutions

  1. Open the weapons yaml and confirm a weapon with the matching name exists; copy the exact name into DemolishWeapon.
  2. If the weapon was removed, repoint DemolishWeapon to a current weapon or re-add the missing one.
  3. Check that the mod's mod.yaml/metadata includes the file that defines the weapon.

Example fix

// before
Bridge:
	DemolishWeapon: Demoish   # typo
// after
Bridge:
	DemolishWeapon: Demolish
Defensive patterns

Strategy: validation

Validate before calling

var info = (BridgeInfo)actorInfo;
var key = info.DemolishWeapon.ToLowerInvariant();
if (!rules.Weapons.ContainsKey(key))
    throw new ConfigException($"{actorInfo.Name}: DemolishWeapon '{key}' not in weapons ruleset");

Try / catch

try { RulesetLoader.Load(modData, map); }
catch (YamlException ex) { Log.ModError(ex.Message); }

Prevention

When it happens

Trigger: DemolishWeapon names a weapon that is not in rules.Weapons after ToLowerInvariant() — typo, removed weapon, or the weapons yaml was not loaded by the mod/map.

Common situations: Renaming a weapon without updating bridge references; splitting a mod and dropping the file that defined "Demolish"; casing/whitespace differences in the name; referencing a weapon from another mod that isn't a dependency.

Related errors


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