stride3d/stride · error · ContentStreamingException

Missing file provider.

Error message

Missing file provider.

What it means

ContentChunk.GetData lazily loads chunk bytes from storage on first access and needs a DatabaseFileProvider to open the underlying file. If no provider is supplied the chunk cannot locate its Storage file, so a ContentStreamingException (with the Storage attached) is thrown.

Solutions

  1. Pass a valid DatabaseFileProvider (from the content manager's file provider) to GetData.
  2. Ensure the content/VFS system is initialized before deserializing chunks.
  3. Load the chunk through ContentManager APIs that wire the provider automatically.

Example fix

// before
var ptr = chunk.GetData(null);
// after
var provider = contentManager.FileProvider as DatabaseFileProvider;
var ptr = chunk.GetData(provider);
Defensive patterns

Strategy: validation

Validate before calling

if (fileProvider == null)
    throw new InvalidOperationException("GetData requires a DatabaseFileProvider; initialize the content/VFS system first.");

Type guard

static bool CanLoad(ContentChunk chunk, DatabaseFileProvider p) => chunk.IsLoaded || p != null;

Try / catch

try { ptr = chunk.GetData(provider); }
catch (ContentStreamingException ex) {
    logger.Error($"Chunk load failed for {ex.Storage?.Url}: {ex.Message}");
}

Prevention

When it happens

Trigger: Calling ContentChunk.GetData(null) on a not-yet-loaded chunk; passing a provider only on some code paths (e.g. warm-up skips it).

Common situations: Loading content in a context where the VFS/database file provider wasn't initialized (unit tests, background threads before DatabaseSetup); refactoring that drops the fileProvider argument.

Related errors


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

Appendix: source

Thrown at sources/core/Stride.Core.Serialization/Streaming/ContentChunk.cs:86

    /// <summary>
    /// Registers the usage operation of chunk data.
    /// </summary>
    public void RegisterUsage()
    {
        LastAccessTime = DateTime.UtcNow;
    }

    /// <summary>
    /// Loads chunk data from the storage container.
    /// </summary>
    /// <param name="fileProvider">Database file provider.</param>
    public unsafe IntPtr GetData(DatabaseFileProvider fileProvider)
    {
        if (IsLoaded)
            return data;

        if (fileProvider == null)
            throw new ContentStreamingException("Missing file provider.", Storage);

        using (var stream = fileProvider.OpenStream(Storage.Url, VirtualFileMode.Open, VirtualFileAccess.Read, VirtualFileShare.Read, StreamFlags.Seekable))
        {
            stream.Position = Location;

#if USE_UNMANAGED
            var chunkBytes = MemoryUtilities.Allocate(Size);

            var bufferCapacity = Math.Min(8192u, (uint)Size);
            var buffer = new byte[bufferCapacity];

            var count = (uint)Size;
            fixed (byte* bufferStart = buffer) // null if array is empty or null
            {
                var chunkBytesPtr = (byte*)chunkBytes;
                do
                {
                    var read = (uint)stream.Read(buffer, 0, (int)Math.Min(count, bufferCapacity));

View on GitHub (pinned to 96fad776d2)