stride3d/stride · error · ArgumentException
name
Error message
name
What it means
AnimationComponent.Crossfade throws ArgumentException when no animation with the given name exists in the Animations dictionary. The check `!Animations.ContainsKey(name)` guards against starting a fade to a clip that was never registered on this component, since a crossfade requires an existing playing-animation target. The exception message is just the parameter name, which is a known Stride quirk (it uses `nameof(name)` as the message).
Solutions
- Check Animations.ContainsKey(name) before calling Crossfade and handle the missing case explicitly.
- Verify the animation was registered on the same AnimationComponent instance you are calling Crossfade on.
- Log or enumerate Animations.Keys to confirm the exact registered name (watch casing).
Example fix
// before
animComponent.Crossfade("Walk", TimeSpan.FromSeconds(0.3));
// after
if (animComponent.Animations.ContainsKey("Walk"))
animComponent.Crossfade("Walk", TimeSpan.FromSeconds(0.3));
else
Log.Warning($"Animation 'Walk' not found. Available: {string.Join(", ", animComponent.Animations.Keys)}"); Defensive patterns
Strategy: validation
Validate before calling
if (animComponent.Animations.ContainsKey(name))
animComponent.Crossfade(name, fade);
else
Log.Warning($"Animation '{name}' not registered."); Try / catch
try { animComponent.Crossfade(name, fade); }
catch (ArgumentException) { Log.Warning($"Crossfade target '{name}' not found on AnimationComponent."); } Prevention
- Centralize animation names in string constants shared with asset setup.
- Validate all clip names at scene load time, not at gameplay time.
- Watch for casing differences between asset names and code strings.
When it happens
Trigger: Calling Crossfade("Walk", TimeSpan.FromSeconds(0.3)) when "Walk" was never added via Animations.Add, after the animation was removed, or when the name string differs in case/spelling from the registered key.
Common situations: Typos in animation clip names, renamed assets after code was written, loading animations asynchronously and crossfading before registration completes, or sharing animation code between entities that have different animation sets.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Value must be null for action != (MemberActionType.SetValue
- The given type does not implement IObjectFactory/
- Capacity must be greater than 0.
- Capacity must be a power of two
- The alignment must be a positive power of 2.
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/23f7ff79455b4089.
Report an issue: GitHub.
Appendix: source
Thrown at sources/engine/Stride.Engine/Engine/AnimationComponent.cs:140
BlendOperation = blend,
RepeatMode = repeatMode ?? clip.RepeatMode,
};
PlayingAnimations.Add(playingAnimation);
return playingAnimation;
}
/// <summary>
/// Crossfades to a new animation.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="fadeTimeSpan">The fade time span.</param>
/// <exception cref="ArgumentException">name</exception>
public PlayingAnimation Crossfade(string name, TimeSpan fadeTimeSpan)
{
if (!Animations.ContainsKey(name))
throw new ArgumentException(nameof(name));
// Fade all animations
foreach (var otherPlayingAnimation in PlayingAnimations)
{
otherPlayingAnimation.WeightTarget = 0.0f;
otherPlayingAnimation.CrossfadeRemainingTime = fadeTimeSpan;
}
// Blend to new animation
return Blend(name, 1.0f, fadeTimeSpan);
}
/// <summary>
/// Blends progressively a new animation.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="desiredWeight">The desired weight.</param>
/// <param name="fadeTimeSpan">The fade time span.</param>View on GitHub (pinned to 96fad776d2)