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
Thrown by ArmamentInfo.RulesetLoaded when the Armament's Weapon name (lowercased) is absent from the ruleset Weapons table. Every armament must resolve to a WeaponInfo at load time; a missing weapon aborts ruleset assembly with a YamlException.
Source
Thrown at OpenRA.Mods.Common/Traits/Armament.cs:96
[CursorReference]
[Desc("Cursor to display when hovering over a valid target.")]
public readonly string Cursor = "attack";
// TODO: same as above
[CursorReference]
[Desc("Cursor to display when hovering over a valid target that is outside of range.")]
public readonly string OutsideRangeCursor = "attackoutsiderange";
[Desc("Ammo the weapon consumes per shot.")]
public readonly int AmmoUsage = 1;
public override object Create(ActorInitializer init) { return new Armament(init.Self, this); }
public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
{
var weaponToLower = Weapon.ToLowerInvariant();
if (!rules.Weapons.TryGetValue(weaponToLower, out var weaponInfo))
throw new YamlException($"Weapons Ruleset does not contain an entry '{weaponToLower}'");
WeaponInfo = weaponInfo;
ModifiedRange = new WDist(Util.ApplyPercentageModifiers(
WeaponInfo.Range.Length,
ai.TraitInfos<IRangeModifierInfo>().Select(m => m.GetRangeModifierDefault())));
if (WeaponInfo.Burst > 1 && WeaponInfo.BurstDelays.Length > 1 && (WeaponInfo.BurstDelays.Length != WeaponInfo.Burst - 1))
throw new YamlException($"Weapon '{weaponToLower}' has an invalid number of BurstDelays, must be single entry or Burst - 1.");
if (WeaponInfo.ReloadDelay <= 0)
throw new YamlException($"Weapon '{weaponToLower}' ReloadDelay value must not be equal to or lower than 0");
base.RulesetLoaded(rules, ai);
}
}
public class Armament : PausableConditionalTrait<ArmamentInfo>, ITick
{View on GitHub (pinned to a520984d91)
Solutions
- Confirm the Weapon value matches (case-insensitively) an existing weapons.yaml entry.
- Add the missing weapon definition to weapons.yaml.
- Correct typos/whitespace in the Weapon field.
- If migrating mods, port the required weapon definitions alongside the actor.
Defensive patterns
Strategy: validation
Validate before calling
// Validate armament weapon exists at load time
var key = weapon.ToLowerInvariant();
if (!rules.Weapons.ContainsKey(key))
throw new YamlException($"Armament weapon '{key}' not found in ruleset."); Type guard
bool WeaponExists(Ruleset rules, string name) => rules.Weapons.ContainsKey(name.ToLowerInvariant());
Prevention
- Ensure every Armament Weapon matches a weapons.yaml entry.
- Run a ruleset validator that resolves all weapon references.
- Port weapon definitions when migrating actors between mods.
When it happens
Trigger: An actor's Armament trait declares a Weapon that is not defined in weapons.yaml, or is defined in a mod not loaded. Raised during RulesetLoaded for the actor.
Common situations: Typo in the Weapon field; referencing a weapon removed in a mod update; case mismatch; weapon defined under a different mod/parent; copy-pasting an actor without copying its weapon.
Related errors
- Weapons Ruleset does not contain an entry '{weaponToLower}'
- Chronoshiftable requires actors to have the Mobile or Husk t
- GrantConditionOnJumpjetLayer requires Mobile to be linked to
- Weapons Ruleset does not contain an entry '{weaponToLower}'
- Weapons Ruleset does not contain an entry '{thumpDamageWeapo
AI-assisted analysis of OpenRA/OpenRA@a520984d91 (2026-08-13).
Data as JSON: /api/errors/276601d11331007a.
Report an issue: GitHub.