stride3d/stride · error · AssetException

Failed to compile a video asset. Unexpected exception.

Error message

Failed to compile a video asset. Unexpected exception.

What it means

Stride's VideoAssetCompiler wraps any unexpected exception thrown while compiling a video asset into an AssetException with this fixed message. The original exception is preserved as the InnerException, so the real cause must be read from there. It exists so asset compilation failures surface with a consistent, asset-scoped error type.

Solutions

  1. Inspect the InnerException of the AssetException for the root cause (use -verbose build logging)
  2. Verify the source video file exists, is readable, and plays in a standard player
  3. Re-encode the video to a common codec (H.264/MP4) and re-import
  4. Update or reinstall media codecs / try a different Stride version if the pipeline crashes

Example fix

// before: opaque failure
try { CompileVideo(asset); } catch (AssetException ex) { Log(ex.Message); }
// after: surface root cause
try { CompileVideo(asset); } catch (AssetException ex) { Log(ex.Message + " -> " + ex.InnerException); }
Defensive patterns

Strategy: try-catch

Validate before calling

var src = videoAsset.Source;
if (src == null || !File.Exists(src)) throw new InvalidOperationException($"Video source missing: {src}");

Try / catch

try
{
    await game.Content.LoadAsync<VideoAsset>(url);
}
catch (AssetException ex)
{
    logger.LogError(ex.InnerException, "Video asset {Url} failed to compile", url);
}

Prevention

When it happens

Trigger: Any non-AssetException exception during VideoAssetCompiler.DoCommandOverride: corrupt or unreadable video file, missing codecs/decoder, I/O failure reading the source, or a crash inside the video processing pipeline.

Common situations: Importing a video with an unsupported codec, a video file moved or deleted after import, or an engine bug/regression in the media pipeline during a build.

Related errors


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

Appendix: source

Thrown at sources/engine/Stride.Assets/Media/VideoAssetCompiler.cs:260

                        assetManager.Save(Url, video);

                        return ResultStatus.Successful;
                    }
                    finally
                    {
                        if (mustReEncodeVideo)
                        {
                            if (tempFile != null) File.Delete(tempFile);
                        }
                    }
                }
                catch (AssetException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    throw new AssetException("Failed to compile a video asset. Unexpected exception.", ex);
                }
            }
        }
    }

    /// <summary>
    /// SharedParameters used for converting/processing the video in the storage.
    /// </summary>
    [DataContract]
    public class VideoConvertParameters
    {
        public VideoConvertParameters()
        {
        }

        public VideoConvertParameters(
            UFile sourcePathFromDisk,
            VideoAsset video,

View on GitHub (pinned to 96fad776d2)