ppy/osu · error · ArgumentOutOfRangeException
Unsupported animation style
Error message
Unsupported animation style
What it means
OsuModApproachDifferent.GetEasing() maps each AnimationStyle enum value to an Easing function used for approach-circle animation. The default case throws ArgumentOutOfRangeException for any enum value not covered, ensuring an unknown style is never silently assigned a default easing.
Source
Thrown at osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs:87
return Easing.In;
case AnimationStyle.Accelerate2:
return Easing.InCubic;
case AnimationStyle.Accelerate3:
return Easing.InQuint;
case AnimationStyle.Decelerate1:
return Easing.Out;
case AnimationStyle.Decelerate2:
return Easing.OutCubic;
case AnimationStyle.Decelerate3:
return Easing.OutQuint;
default:
throw new ArgumentOutOfRangeException(nameof(style), style, @"Unsupported animation style");
}
}
public enum AnimationStyle
{
Linear,
Gravity,
InOut1,
InOut2,
Accelerate1,
Accelerate2,
Accelerate3,
Decelerate1,
Decelerate2,
Decelerate3,
}
}
}
View on GitHub (pinned to d9c73e12ad)
Solutions
- Add a case for the new AnimationStyle value returning the appropriate Easing function.
- If the enum is serialized/deserialized, validate the value against the known set before use.
Example fix
// before
case AnimationStyle.Decelerate3:
return Easing.OutQuint;
default:
throw new ArgumentOutOfRangeException(nameof(style), style, @"Unsupported animation style");
// after — add the missing case
case AnimationStyle.Decelerate3:
return Easing.OutQuint;
case AnimationStyle.Accelerate4:
return Easing.InCubic;
default:
throw new ArgumentOutOfRangeException(nameof(style), style, @"Unsupported animation style"); Defensive patterns
Strategy: type-guard
Validate before calling
// Validate the animation style before calling GetEasing
if (!Enum.IsDefined(typeof(AnimationStyle), style))
throw new ArgumentOutOfRangeException($"Unknown animation style: {style}"); Type guard
// Type guard for AnimationStyle exhaustiveness
static bool IsSupportedStyle(AnimationStyle style)
=> Enum.IsDefined(typeof(AnimationStyle), style)
&& style != (AnimationStyle)(-1); Prevention
- When adding a new AnimationStyle enum member, add the case immediately in the same commit.
- Use switch expressions (C# 8+) that produce compiler warnings for non-exhaustive enums.
- Add a unit test that iterates all enum values through GetEasing.
When it happens
Trigger: A new AnimationStyle enum member is added without a corresponding case in GetEasing's switch, and the mod is configured with that style.
Common situations: Extending the approach-different mod with a new animation style but forgetting to add the easing mapping; enum deserialization producing a value outside the known set.
Related errors
- Unsupported grid type.
- Cannot Begin a rotate operation while another is in progress
- Cannot Update a rotate operation without calling Begin first
- Cannot Commit a rotate operation without calling Begin first
- Cannot Begin a scale operation while another is in progress!
AI-assisted analysis of ppy/osu@d9c73e12ad (2026-08-13).
Data as JSON: /api/errors/4bab9beded5d6b87.
Report an issue: GitHub.