ppy/osu · error · ArgumentOutOfRangeException

Invalid component type: {component}

Error message

Invalid component type: {component}

What it means

TaikoLegacySkinTransformer.GetHitExplosionName() maps TaikoSkinComponents explosion types (Miss, Ok, Great) to legacy skin texture filenames. Unhandled component values throw ArgumentOutOfRangeException, preventing an invalid lookup that would produce a null or wrong skin element name.

Source

Thrown at osu.Game.Rulesets.Taiko/Skinning/Legacy/TaikoLegacySkinTransformer.cs:247

            return base.GetDrawableComponent(lookup);
        }

        private string getHitName(TaikoSkinComponents component)
        {
            switch (component)
            {
                case TaikoSkinComponents.TaikoExplosionMiss:
                    return "taiko-hit0";

                case TaikoSkinComponents.TaikoExplosionOk:
                    return "taiko-hit100";

                case TaikoSkinComponents.TaikoExplosionGreat:
                    return "taiko-hit300";
            }

            throw new ArgumentOutOfRangeException(nameof(component), $"Invalid component type: {component}");
        }

        public override ISample? GetSample(ISampleInfo sampleInfo)
        {
            if (sampleInfo is HitSampleInfo hitSampleInfo)
                return base.GetSample(new LegacyTaikoSampleInfo(hitSampleInfo));

            return base.GetSample(sampleInfo);
        }

        private class LegacyTaikoSampleInfo : HitSampleInfo
        {
            public LegacyTaikoSampleInfo(HitSampleInfo sampleInfo)
                : base(sampleInfo.Name, sampleInfo.Bank, sampleInfo.Suffix, sampleInfo.Volume, sampleInfo.EditorAutoBank, sampleInfo.UseBeatmapSamples)

            {
            }

View on GitHub (pinned to d9c73e12ad)

Solutions

  1. Add a case for the new TaikoSkinComponents explosion value returning the appropriate legacy skin texture name.
  2. Ensure only explosion-related components are routed to GetHitExplosionName — verify the caller's component selection logic.

Example fix

// before
case TaikoSkinComponents.TaikoExplosionGreat:
    return "taiko-hit300";
default:
    throw new ArgumentOutOfRangeException(nameof(component), $"Invalid component type: {component}");

// after — add the missing case
case TaikoSkinComponents.TaikoExplosionGreat:
    return "taiko-hit300";
case TaikoSkinComponents.TaikoExplosionGood:
    return "taiko-hit100-alt";
default:
    throw new ArgumentOutOfRangeException(nameof(component), $"Invalid component type: {component}");
Defensive patterns

Strategy: type-guard

Validate before calling

// Validate the component is an explosion type before calling GetHitExplosionName
static bool IsExplosionComponent(TaikoSkinComponents component)
    => component is TaikoSkinComponents.TaikoExplosionMiss
        or TaikoSkinComponents.TaikoExplosionOk
        or TaikoSkinComponents.TaikoExplosionGreat;

Type guard

static bool IsExplosionComponent(TaikoSkinComponents component)
    => component is TaikoSkinComponents.TaikoExplosionMiss
        or TaikoSkinComponents.TaikoExplosionOk
        or TaikoSkinComponents.TaikoExplosionGreat;

Prevention

When it happens

Trigger: A TaikoSkinComponents enum value not in the three handled cases (TaikoExplosionMiss, TaikoExplosionOk, TaikoExplosionGreat) is passed to this lookup method — e.g., a non-explosion component or a newly added explosion type.

Common situations: A new TaikoSkinComponents explosion member is added without updating this transformer; a routing error that sends a non-explosion component (e.g., TaikoHitTarget, TaikoKiaiGlow) to this method.

Related errors


AI-assisted analysis of ppy/osu@d9c73e12ad (2026-08-13). Data as JSON: /api/errors/5776d5a9f3a89dea. Report an issue: GitHub.