ppy/osu · error · InvalidOperationException
{nameof(ModTestData.Autoplay)} must be false when {nameof(Mo
Error message
{nameof(ModTestData.Autoplay)} must be false when {nameof(ModTestData.ReplayFrames)} is specified. What it means
Thrown in ModTestPlayer.PrepareReplay when currentTestData.Autoplay is true AND currentTestData.ReplayFrames has a non-zero count. The test harness cannot honor both an autoplay mod (which generates its own replay) and explicit replay frames, so the combination is rejected as a contradictory test setup.
Source
Thrown at osu.Game/Tests/Visual/ModTestScene.cs:78
protected partial class ModTestPlayer : TestPlayer
{
private readonly bool allowFail;
private readonly ModTestData currentTestData;
protected override bool CheckModsAllowFailure() => allowFail;
public ModTestPlayer(ModTestData data, bool allowFail)
: base(true, false)
{
this.allowFail = allowFail;
currentTestData = data;
}
protected override void PrepareReplay()
{
if (currentTestData.Autoplay && currentTestData.ReplayFrames?.Count > 0)
throw new InvalidOperationException(@$"{nameof(ModTestData.Autoplay)} must be false when {nameof(ModTestData.ReplayFrames)} is specified.");
if (currentTestData.ReplayFrames != null)
{
DrawableRuleset?.SetReplayScore(new Score
{
Replay = new Replay { Frames = currentTestData.ReplayFrames },
ScoreInfo = new ScoreInfo { User = new APIUser { Username = @"Test" } },
});
}
base.PrepareReplay();
}
}
protected class ModTestData
{
/// <summary>
/// Whether to use a replay to simulate an autoplay. True by default.
View on GitHub (pinned to d9c73e12ad)
Solutions
- Set ModTestData.Autoplay = false when you supply ReplayFrames.
- If you want autoplay-generated input, leave ReplayFrames null.
- Add an assertion/guard in test helpers to fail fast at test-definition time rather than at runtime.
Example fix
// before
new ModTestData { Autoplay = true, ReplayFrames = new List<ReplayFrame> { ... } };
// after
new ModTestData { Autoplay = false, ReplayFrames = new List<ReplayFrame> { ... } }; Defensive patterns
Strategy: validation
Validate before calling
if (data.Autoplay && data.ReplayFrames?.Count > 0)
throw new ArgumentException("Cannot set both Autoplay and ReplayFrames."); Type guard
static bool IsValidModTestData(ModTestData d)
=> !(d.Autoplay && (d.ReplayFrames?.Count ?? 0) > 0); Prevention
- Set Autoplay = false when providing ReplayFrames.
- Leave ReplayFrames null for autoplay-driven tests.
- Validate ModTestData at construction.
When it happens
Trigger: Constructing a ModTestData with Autoplay = true and a non-empty ReplayFrames list, then running the ModTestScene.
Common situations: Test authoring mistake: enabling an autoplay mod while also providing canned replay frames; copy-pasting a test config and forgetting to clear Autoplay.
Related errors
- Provided client ID must be an integer.
- Can't have zero or fewer stages.
- Unknown hit object type.
- No valid beatmap files found in the beatmap archive.
- {setInfo.GetDisplayString()} already has a difficulty with t
AI-assisted analysis of ppy/osu@d9c73e12ad (2026-08-13).
Data as JSON: /api/errors/79ff175601a0a64d.
Report an issue: GitHub.