OpenRA/OpenRA · error · YamlException

Weapons Ruleset does not contain an entry '{detonationWeapon

Error message

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

What it means

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.

Source

Thrown at OpenRA.Mods.Cnc/Traits/MadTank.cs:83

		[Desc("Cursor to display when targeting.")]
		public readonly string AttackCursor = "attack";

		[CursorReference]
		[Desc("Cursor to display when able to set up the detonation sequence.")]
		public readonly string DeployCursor = "deploy";

		public override object Create(ActorInitializer init) { return new MadTank(this); }

		public void RulesetLoaded(Ruleset rules, ActorInfo ai)
		{
			var thumpDamageWeaponToLower = (ThumpDamageWeapon ?? string.Empty).ToLowerInvariant();
			var detonationWeaponToLower = (DetonationWeapon ?? string.Empty).ToLowerInvariant();

			if (!rules.Weapons.TryGetValue(thumpDamageWeaponToLower, out var thumpDamageWeapon))
				throw new YamlException($"Weapons Ruleset does not contain an entry '{thumpDamageWeaponToLower}'");

			if (!rules.Weapons.TryGetValue(detonationWeaponToLower, out var detonationWeapon))
				throw new YamlException($"Weapons Ruleset does not contain an entry '{detonationWeaponToLower}'");

			ThumpDamageWeaponInfo = thumpDamageWeapon;
			DetonationWeaponInfo = detonationWeapon;
		}
	}

	sealed class MadTank : IIssueOrder, IResolveOrder, IOrderVoice, IIssueDeployOrder
	{
		readonly MadTankInfo info;

		bool initiated;

		public MadTank(MadTankInfo info)
		{
			this.info = info;
		}

		public IEnumerable<IOrderTargeter> Orders

View on GitHub (pinned to a520984d91)

Solutions

  1. Set DetonationWeapon to a valid weapon name defined in the mod's weapons YAML.
  2. Check for typos and ensure the name matches a defined weapon (case-insensitive).
  3. Create the weapon definition if it does not exist.
  4. Note that null/empty is not valid — a weapon name is required.

Example fix

# before (yaml):
MadTank:
  DetonationWeapon:

# after:
MadTank:
  DetonationWeapon: MadTankDetonate
Defensive patterns

Strategy: validation

Validate before calling

// Before RulesetLoaded, verify DetonationWeapon:
var key = (DetonationWeapon ?? string.Empty).ToLowerInvariant();
if (string.IsNullOrEmpty(key) || !rules.Weapons.ContainsKey(key))
    // Report: DetonationWeapon is missing or undefined

Type guard

static bool DetonationWeaponValid(Ruleset rules, string weapon)
{
    return !string.IsNullOrEmpty(weapon) && rules.Weapons.ContainsKey(weapon.ToLowerInvariant());
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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