ppy/osu · warning · NotSupportedException
Attempting to add a new component to a target container whic
Error message
Attempting to add a new component to a target container which is not supported by the current skin.
What it means
Thrown by SkinnableContainer.Add when the internal content drawable is null, meaning the current skin does not provide a target container for this skinnable target. Adding components is only possible when the skin exposes a backing container.
Source
Thrown at osu.Game/Skinning/SkinnableContainer.cs:85
cancellationSource?.Cancel();
cancellationSource = null;
LoadComponentAsync(content, wrapper =>
{
AddInternal(wrapper);
components.AddRange(wrapper.Children.OfType<ISerialisableDrawable>());
ComponentsLoaded = true;
OnComponentsLoaded?.Invoke(this);
}, (cancellationSource = new CancellationTokenSource()).Token);
}
/// <inheritdoc cref="ISerialisableDrawableContainer"/>
/// <exception cref="NotSupportedException">Thrown when attempting to add an element to a target which is not supported by the current skin.</exception>
/// <exception cref="ArgumentException">Thrown if the provided instance is not a <see cref="Drawable"/>.</exception>
public void Add(ISerialisableDrawable component)
{
if (content == null)
throw new NotSupportedException("Attempting to add a new component to a target container which is not supported by the current skin.");
if (!(component is Drawable drawable))
throw new ArgumentException($"Provided argument must be of type {nameof(Drawable)}.", nameof(component));
content.Add(drawable);
components.Add(component);
}
/// <inheritdoc cref="ISerialisableDrawableContainer"/>
/// <exception cref="NotSupportedException">Thrown when attempting to add an element to a target which is not supported by the current skin.</exception>
/// <exception cref="ArgumentException">Thrown if the provided instance is not a <see cref="Drawable"/>.</exception>
public void Remove(ISerialisableDrawable component, bool disposeImmediately)
{
if (content == null)
throw new NotSupportedException("Attempting to remove a new component from a target container which is not supported by the current skin.");
if (!(component is Drawable drawable))
throw new ArgumentException($"Provided argument must be of type {nameof(Drawable)}.", nameof(component));
View on GitHub (pinned to d9c73e12ad)
Solutions
- Check the container supports custom components for the current skin before exposing Add UI (e.g. guard with a SupportsCustomComponents check or try/catch).
- Switch to a skin that supports the target (modern/default skins typically do).
- Ensure Reload/components-loaded completed before Add.
Example fix
// before
container.Add(component); // throws if content == null
// after
try { container.Add(component); }
catch (NotSupportedException) { Logger.Log("This skin does not support custom components here."); } Defensive patterns
Strategy: validation
Validate before calling
if (!container.ComponentsLoaded)
throw new InvalidOperationException("Container not loaded; cannot Add."); Try / catch
try { container.Add(component); }
catch (NotSupportedException) { /* skin does not support custom components */ } Prevention
- Check the skin supports the target before exposing Add UI.
- Ensure Reload completed before Add.
- Switch to a modern/default skin for custom components.
When it happens
Trigger: Calling Add(component) on a SkinnableContainer whose skin does not supply a content container (e.g. a legacy skin that draws elements natively, or a target unsupported by the current skin type).
Common situations: Trying to customize components on a target the current skin renders non-declaratively; calling Add before components have loaded; skin switched to one without container support.
Related errors
- Attempting to remove a new component from a target container
- Attempting to use this setter will not work correctly. Use s
- A {nameof(PoolableSkinnableSample)} cannot be applied multip
- Setting {nameof(CurrentSkin)}'s value directly is not suppor
- Provided argument must be of type {nameof(Drawable)}.
AI-assisted analysis of ppy/osu@d9c73e12ad (2026-08-13).
Data as JSON: /api/errors/636414bdf6d3a429.
Report an issue: GitHub.