{"record":{"id":"caec8d5795b1ea61","repo":"OpenRA/OpenRA","slug":"weapons-ruleset-does-not-contain-an-entry-detona","errorCode":null,"errorMessage":"Weapons Ruleset does not contain an entry '{detonationWeaponToLower}'","messagePattern":"Weapons Ruleset does not contain an entry '(.+?)'","errorType":"validation","errorClass":"YamlException","httpStatus":null,"severity":"error","filePath":"OpenRA.Mods.Cnc/Traits/MadTank.cs","lineNumber":83,"sourceCode":"\t\t[Desc(\"Cursor to display when targeting.\")]\n\t\tpublic readonly string AttackCursor = \"attack\";\n\n\t\t[CursorReference]\n\t\t[Desc(\"Cursor to display when able to set up the detonation sequence.\")]\n\t\tpublic readonly string DeployCursor = \"deploy\";\n\n\t\tpublic override object Create(ActorInitializer init) { return new MadTank(this); }\n\n\t\tpublic void RulesetLoaded(Ruleset rules, ActorInfo ai)\n\t\t{\n\t\t\tvar thumpDamageWeaponToLower = (ThumpDamageWeapon ?? string.Empty).ToLowerInvariant();\n\t\t\tvar detonationWeaponToLower = (DetonationWeapon ?? string.Empty).ToLowerInvariant();\n\n\t\t\tif (!rules.Weapons.TryGetValue(thumpDamageWeaponToLower, out var thumpDamageWeapon))\n\t\t\t\tthrow new YamlException($\"Weapons Ruleset does not contain an entry '{thumpDamageWeaponToLower}'\");\n\n\t\t\tif (!rules.Weapons.TryGetValue(detonationWeaponToLower, out var detonationWeapon))\n\t\t\t\tthrow new YamlException($\"Weapons Ruleset does not contain an entry '{detonationWeaponToLower}'\");\n\n\t\t\tThumpDamageWeaponInfo = thumpDamageWeapon;\n\t\t\tDetonationWeaponInfo = detonationWeapon;\n\t\t}\n\t}\n\n\tsealed class MadTank : IIssueOrder, IResolveOrder, IOrderVoice, IIssueDeployOrder\n\t{\n\t\treadonly MadTankInfo info;\n\n\t\tbool initiated;\n\n\t\tpublic MadTank(MadTankInfo info)\n\t\t{\n\t\t\tthis.info = info;\n\t\t}\n\n\t\tpublic IEnumerable<IOrderTargeter> Orders","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/OpenRA/OpenRA/blob/a520984d91eda9de48a62b1d15c1e3bad0d4fb1a/OpenRA.Mods.Cnc/Traits/MadTank.cs#L65-L101","documentation":"Thrown by MadTankInfo.RulesetLoaded when the DetonationWeapon field (null-coalesced to empty string, lowercased) is not found in the weapons ruleset. This is the second weapon check in MadTank — the final detonation/explosion weapon. Same pattern as the ThumpDamageWeapon check but for the detonation stage.","triggerScenarios":"An actor definition includes the MadTank trait but DetonationWeapon references a weapon name not in rules.Weapons. If null, it defaults to empty-string lookup which will fail. Fires during RulesetLoaded.","commonSituations":"DetonationWeapon is unset (null) leading to empty-string lookup failure; typo in weapon name; weapon renamed/removed in a mod update; weapon definition exists only in an unloaded mod package.","solutions":["Set DetonationWeapon to a valid weapon name defined in the mod's weapons YAML.","Check for typos and ensure the name matches a defined weapon (case-insensitive).","Create the weapon definition if it does not exist.","Note that null/empty is not valid — a weapon name is required."],"exampleFix":"# before (yaml):\nMadTank:\n  DetonationWeapon:\n\n# after:\nMadTank:\n  DetonationWeapon: MadTankDetonate","handlingStrategy":"validation","validationCode":"// Before RulesetLoaded, verify DetonationWeapon:\nvar key = (DetonationWeapon ?? string.Empty).ToLowerInvariant();\nif (string.IsNullOrEmpty(key) || !rules.Weapons.ContainsKey(key))\n    // Report: DetonationWeapon is missing or undefined","typeGuard":"static bool DetonationWeaponValid(Ruleset rules, string weapon)\n{\n    return !string.IsNullOrEmpty(weapon) && rules.Weapons.ContainsKey(weapon.ToLowerInvariant());\n}","tryCatchPattern":null,"preventionTips":["Always set DetonationWeapon to a valid weapon name.","Never leave it null — the lookup will fail on empty string.","Cross-reference weapon names against the weapons YAML."],"tags":["config","weapon","ruleset","yaml","reference"],"backgroundTag":null,"analyzedSha":"a520984d91eda9de48a62b1d15c1e3bad0d4fb1a","analyzedAt":"2026-08-13T15:30:14.787Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}