stride3d/stride · error · ArgumentException

The type is not an asset type

Error message

The type {assetType.Name} is not an asset type

What it means

Guard in GetDefinition: the registry was asked for a property-graph definition for a type that is not an Asset (IsAssignableFrom check failed). The faulting input is the assetType argument, which does not inherit from Asset.

Solutions

  1. Only request definitions for types deriving from Asset
  2. Register or look up the correct Asset-derived type instead of a raw data type
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at sources/assets/Stride.Core.Assets.Quantum/AssetQuantumRegistry.cs:107 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/f4cf0a5845137e48. Report an issue: GitHub.

Appendix: source

Thrown at sources/assets/Stride.Core.Assets.Quantum/AssetQuantumRegistry.cs:107

    public static AssetPropertyGraph ConstructPropertyGraph(AssetPropertyGraphContainer container, AssetItem assetItem, ILogger? logger)
    {
        var assetType = assetItem.Asset.GetType();
        while (assetType is not null)
        {
            var typeToTest = assetType.IsGenericType ? assetType.GetGenericTypeDefinition() : assetType;
            if (NodeGraphTypes.TryGetValue(typeToTest, out var propertyGraphType))
            {
                return (AssetPropertyGraph)Activator.CreateInstance(propertyGraphType, container, assetItem, logger)!;
            }
            assetType = assetType.BaseType;
        }
        throw new InvalidOperationException("No AssetPropertyGraph type matching the given asset type has been found");
    }

    public static AssetPropertyGraphDefinition GetDefinition(Type assetType)
    {
        if (!typeof(Asset).IsAssignableFrom(assetType))
            throw new ArgumentException($"The type {assetType.Name} is not an asset type");

        var currentType = assetType;
        while (currentType is not null && currentType != typeof(Asset))
        {
            // ReSharper disable once AssignNullToNotNullAttribute - cannot happen
            if (NodeGraphDefinitions.TryGetValue(currentType, out var definition))
            {
                // Register the instance for this specific type so we don't have to do this again next time.
                if (currentType != assetType)
                {
                    NodeGraphDefinitions.Add(assetType, definition);
                }
                return definition;
            }

            if (currentType.IsGenericType)
            {
                // If we reach a generic type, we must check if we have a matching generic definition and if so, create a proper instance of this generic type.

View on GitHub (pinned to 96fad776d2)