ppy/osu · warning · ArgumentOutOfRangeException
Mascot animations for state {state} are not supported
Error message
Mascot animations for state {state} are not supported What it means
Thrown by createTextureAnimation when the TaikoMascotAnimationState enum value passed to the constructor is not one of the handled cases (Clear, Idle, Kiai, Fail). The switch covers all four declared enum members, so the default branch only fires when an invalid/cast enum value (e.g. (TaikoMascotAnimationState)99) is supplied. This is a defensive guard against corruption or misuse rather than a normal runtime path.
Source
Thrown at osu.Game.Rulesets.Taiko/UI/TaikoMascotAnimation.cs:73
textureAnimation.GotoFrame(currentFrame);
currentFrame = (currentFrame + 1) % textureAnimation.FrameCount;
}
private static TextureAnimation createTextureAnimation(TaikoMascotAnimationState state)
{
switch (state)
{
case TaikoMascotAnimationState.Clear:
return new ClearMascotTextureAnimation();
case TaikoMascotAnimationState.Idle:
case TaikoMascotAnimationState.Kiai:
case TaikoMascotAnimationState.Fail:
return new ManualMascotTextureAnimation(state);
default:
throw new ArgumentOutOfRangeException(nameof(state), $"Mascot animations for state {state} are not supported");
}
}
private partial class ManualMascotTextureAnimation : TextureAnimation
{
private readonly TaikoMascotAnimationState state;
public ManualMascotTextureAnimation(TaikoMascotAnimationState state)
{
this.state = state;
IsPlaying = false;
}
[BackgroundDependencyLoader]
private void load(ISkinSource source)
{
ISkin? skin = source.FindProvider(s => getAnimationFrame(s, state, 0) != null);
View on GitHub (pinned to d9c73e12ad)
Solutions
- Ensure only the four valid TaikoMascotAnimationState values (Idle, Clear, Kiai, Fail) are ever passed to the TaikoMascotAnimation constructor.
- If the state originates from an external source (deserialization, config), validate it with Enum.IsDefined before constructing.
- If extending the mascot system with new states, add a matching case to the switch in createTextureAnimation at TaikoMascotAnimation.cs:62.
Example fix
// before
var state = (TaikoMascotAnimationState)rawIndex;
var mascot = new TaikoMascotAnimation(state);
// after
if (!Enum.IsDefined(typeof(TaikoMascotAnimationState), rawIndex))
throw new ArgumentOutOfRangeException(nameof(rawIndex));
var state = (TaikoMascotAnimationState)rawIndex;
var mascot = new TaikoMascotAnimation(state); Defensive patterns
Strategy: type-guard
Validate before calling
// Validate before constructing
if (!Enum.IsDefined(typeof(TaikoMascotAnimationState), state))
throw new ArgumentOutOfRangeException(nameof(state), $"Invalid mascot state: {state}");
var animation = new TaikoMascotAnimation(state); Type guard
static bool IsValidMascotState(TaikoMascotAnimationState state)
=> Enum.IsDefined(typeof(TaikoMascotAnimationState), state); Prevention
- Never cast raw integers to TaikoMascotAnimationState without Enum.IsDefined validation.
- If deserializing mascot state from external data, validate before use.
- If extending the enum, update the switch in createTextureAnimation immediately.
When it happens
Trigger: Constructing `new TaikoMascotAnimation(state)` where `state` is an enum value outside the four valid members — typically produced by casting an arbitrary integer to TaikoMascotAnimationState, or by a deserialized/reflected value that wasn't validated.
Common situations: Deserialization of a corrupted mascot state from a save file or network payload; a ruleset mod that extends the enum or passes an integer state index incorrectly; test code that casts a raw int without bounds-checking.
Related errors
AI-assisted analysis of ppy/osu@d9c73e12ad (2026-08-13).
Data as JSON: /api/errors/a1c321315aa7c8b9.
Report an issue: GitHub.