{"record":{"id":"6aa7b3534f71ca15","repo":"OpenRA/OpenRA","slug":"weapons-ruleset-does-not-contain-an-entry-weapon-6aa7b3","errorCode":null,"errorMessage":"Weapons Ruleset does not contain an entry '{weaponToLower}'","messagePattern":"Weapons Ruleset does not contain an entry '(.+?)'","errorType":"exception","errorClass":"YamlException","httpStatus":null,"severity":"error","filePath":"OpenRA.Mods.Common/Traits/Buildings/Bridge.cs","lineNumber":65,"sourceCode":"\n\t\tpublic WeaponInfo DemolishWeaponInfo { get; private set; }\n\n\t\t[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.\")]\n\t\tpublic readonly BitSet<DamageType> DamageTypes = default;\n\n\t\tpublic override object Create(ActorInitializer init) { return new Bridge(init.Self, this); }\n\n\t\tpublic void RulesetLoaded(Ruleset rules, ActorInfo ai)\n\t\t{\n\t\t\tif (!rules.Actors[SystemActors.World].HasTraitInfo<ITiledTerrainRendererInfo>())\n\t\t\t\tthrow new YamlException(\"Bridge requires a tile-based terrain renderer.\");\n\n\t\t\tif (string.IsNullOrEmpty(DemolishWeapon))\n\t\t\t\tthrow new YamlException(\"A value for DemolishWeapon of a Bridge trait is missing.\");\n\n\t\t\tvar weaponToLower = DemolishWeapon.ToLowerInvariant();\n\t\t\tif (!rules.Weapons.TryGetValue(weaponToLower, out var weapon))\n\t\t\t\tthrow new YamlException($\"Weapons Ruleset does not contain an entry '{weaponToLower}'\");\n\n\t\t\tDemolishWeaponInfo = weapon;\n\t\t}\n\n\t\tpublic IEnumerable<(ushort Template, int Health)> Templates\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\tif (Template != 0)\n\t\t\t\t\tyield return (Template, 100);\n\n\t\t\t\tif (DamagedTemplate != 0)\n\t\t\t\t\tyield return (DamagedTemplate, 49);\n\n\t\t\t\tif (DestroyedTemplate != 0)\n\t\t\t\t\tyield return (DestroyedTemplate, 0);\n\n\t\t\t\tif (DestroyedPlusNorthTemplate != 0)","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/OpenRA/OpenRA/blob/a520984d91eda9de48a62b1d15c1e3bad0d4fb1a/OpenRA.Mods.Common/Traits/Buildings/Bridge.cs#L47-L83","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the weapons yaml and confirm a weapon with the matching name exists; copy the exact name into DemolishWeapon.","If the weapon was removed, repoint DemolishWeapon to a current weapon or re-add the missing one.","Check that the mod's mod.yaml/metadata includes the file that defines the weapon."],"exampleFix":"// before\nBridge:\n\tDemolishWeapon: Demoish   # typo\n// after\nBridge:\n\tDemolishWeapon: Demolish","handlingStrategy":"validation","validationCode":"var info = (BridgeInfo)actorInfo;\nvar key = info.DemolishWeapon.ToLowerInvariant();\nif (!rules.Weapons.ContainsKey(key))\n    throw new ConfigException($\"{actorInfo.Name}: DemolishWeapon '{key}' not in weapons ruleset\");","typeGuard":null,"tryCatchPattern":"try { RulesetLoader.Load(modData, map); }\ncatch (YamlException ex) { Log.ModError(ex.Message); }","preventionTips":["After renaming/removing a weapon, grep bridges and other weapon references for the old name.","Keep a single canonical weapon-name lint across all weapon-referencing traits."],"tags":["openra","yaml","trait","bridge","weapon","ruleset-validation"],"backgroundTag":null,"analyzedSha":"a520984d91eda9de48a62b1d15c1e3bad0d4fb1a","analyzedAt":"2026-08-13T15:30:14.787Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}