stride3d/stride · error · InvalidOperationException
Unable to find a serializer for
Error message
Unable to find a serializer for [{0}] What it means
Load looks up a serializer by the file extension of the path passed in; FindSerializer returned null because no registered serializer handles that extension. The library only knows how to load assets whose extension matches a registered IAssetSerializer. This is a configuration/registration problem, not data corruption.
Solutions
- Check the file path passed to Load has the correct asset extension (e.g. '.sdtex', '.sdscene')
- Register a serializer for the extension via the serializer registration used by FindSerializer
- Verify the file actually is a Stride asset and not a plain text/binary file
- Log assetFileExtension right before Load to confirm what extension is being resolved
Example fix
// before var result = AssetFileSerializer.Load<Texture>(stream, "logo.png"); // after var result = AssetFileSerializer.Load<Texture>(stream, "logo.sdtex");
Defensive patterns
Strategy: validation
Validate before calling
var ext = Path.GetExtension(filePath).ToLowerInvariant();
if (AssetFileSerializer.FindSerializer(ext) == null)
throw new InvalidOperationException($"No serializer registered for '{ext}'"); Try / catch
try { AssetFileSerializer.Load<T>(stream, path, log); }
catch (InvalidOperationException ex) when (ex.Message.StartsWith("Unable to find a serializer"))
{ log.Error($"Unsupported asset extension for {path}: {ex.Message}"); } Prevention
- Only pass paths with registered Stride asset extensions
- Register custom serializers before any load call
- Sanitize downloaded/temp files' extensions before loading
When it happens
Trigger: Calling AssetFileSerializer.Load<T> with a stream and a filePath whose extension (lowercased) is not registered, e.g. '.txt', '.json', or a missing/renamed extension on the UFile path.
Common situations: Passing a temp/download file with wrong extension; opening a custom asset format without registering a serializer; typos in extension; trying to load non-asset files through the asset loader.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Could not find a valid content serializer for
- Unable to find a serializer for
- Could not find serializer for generic dependent type
- Can't find serializer for type
- SetAssetObject has already been called with a different…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/e85f77c88b38082e.
Report an issue: GitHub.
Appendix: source
Thrown at sources/assets/Stride.Core.Assets/AssetFileSerializer.cs:102
/// </summary>
/// <typeparam name="T">Type of the asset</typeparam>
/// <param name="filePath">The file path.</param>
/// <param name="log">The logger.</param>
/// <returns>An instance of Asset not a valid asset asset object file.</returns>
public static AssetLoadResult<T> Load<T>(string filePath, ILogger? log = null, string? assetNamespace = null)
{
using var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
var result = Load<T>(stream, filePath, log, assetNamespace);
return result;
}
public static AssetLoadResult<T> Load<T>(Stream stream, UFile filePath, ILogger? log = null, string? assetNamespace = null)
{
ArgumentNullException.ThrowIfNull(filePath);
var assetFileExtension = Path.GetExtension(filePath).ToLowerInvariant();
var serializer = FindSerializer(assetFileExtension)
?? throw new InvalidOperationException("Unable to find a serializer for [{0}]".ToFormat(assetFileExtension));
var asset = (T)serializer.Load(stream, filePath, log, true, out var aliasOccurred, out var yamlMetadata, assetNamespace);
return new AssetLoadResult<T>(asset, log, aliasOccurred, yamlMetadata);
}
/// <summary>
/// Serializes an <see cref="Asset" /> to the specified file path.
/// </summary>
/// <param name="filePath">The file path.</param>
/// <param name="asset">The asset object.</param>
/// <param name="yamlMetadata"></param>
/// <param name="log">The logger.</param>
/// <exception cref="System.ArgumentNullException">filePath</exception>
public static void Save(string filePath, object asset, AttachedYamlAssetMetadata? yamlMetadata, ILogger? log = null, string? assetNamespace = null)
{
ArgumentNullException.ThrowIfNull(filePath);
// Creates automatically the directory when saving an asset.
filePath = FileUtility.GetAbsolutePath(filePath);View on GitHub (pinned to 96fad776d2)