stride3d/stride · error · ContentStreamingException

Data chunk has invalid size.

Error message

Data chunk has invalid size.

What it means

After locating the chunk for a mip level, StreamingTask validates chunk.Size against mipInfos[totalMipIndex].TotalSize — the expected byte size of that mip computed from the texture description. A mismatch means the stored data does not correspond to the texture layout the streamer expects, and a ContentStreamingException is thrown instead of uploading wrong-sized GPU data.

Solutions

  1. Do a clean rebuild of the texture assets so chunk sizes match the current mipInfos
  2. Delete stale compiled assets/storage and redeploy content from the same build
  3. Verify the ImageDescription passed to StreamingTexture.Init matches the asset's compiled description (format, dimensions, mip count)
  4. Check version control/deployment scripts for partially updated content folders

Example fix

// before
streamingTexture.Init(provider, oldStorage, ref description); // sizes mismatch old chunks
// after
if (chunk.Size == mipInfos[totalMipIndex].TotalSize)
    streamingTexture.Init(provider, storage, ref description);
else
    await RecompileAndReloadAsync(assetUrl);
Defensive patterns

Strategy: validation

Validate before calling

foreach (var mip in mips)
    if (storage.GetChunk(mip.Index)?.Size != mip.TotalSize)
        Logger.Error($"Chunk size mismatch on mip {mip.Index}; rebuild content.");

Try / catch

try
{
    await StreamAsync(mipIndex);
}
catch (ContentStreamingException)
{
    Logger.Warning("Chunk size mismatch; scheduling content rebuild");
}

Prevention

When it happens

Trigger: chunk.Size != mipInfos[totalMipIndex].TotalSize during StreamingTask: storage written with a different texture format/size/mip layout than the ImageDescription passed to Init; assets rebuilt with different dimensions while old storage files remain; manually edited or corrupted storage files.

Common situations: Out-of-sync builds where the header/manifest was updated but the .bin chunks weren't (or vice versa); changing texture format or resolution in the editor without full content rebuild; copying content from an older project version.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at sources/engine/Stride.Rendering/Streaming/StreamingTexture.cs:303

                // Setup texture description
                TextureDescription newDesc = description;
                var newHighestResidentMipIndex = TotalMipLevels - mipsCount;
                newDesc.MipLevelCount = mipsCount;
                var topMip = mipInfos[description.MipLevels - newDesc.MipLevelCount];
                newDesc.Width = topMip.Width;
                newDesc.Height = topMip.Height;

                // Load chunks
                var mipsData = new IntPtr[mipsCount];
                for (var mipIndex = 0; mipIndex < mipsCount; mipIndex++)
                {
                    var totalMipIndex = newHighestResidentMipIndex + mipIndex;
                    var chunk = Storage.GetChunk(totalMipIndex);
                    if (chunk == null)
                        throw new ContentStreamingException("Data chunk is missing.", Storage);

                    if (chunk.Size != mipInfos[totalMipIndex].TotalSize)
                        throw new ContentStreamingException("Data chunk has invalid size.", Storage);

                    var data = chunk.GetData(fileProvider);
                    if (!chunk.IsLoaded)
                        throw new ContentStreamingException("Data chunk is not loaded.", Storage);

                    if (cancellationToken.IsCancellationRequested)
                        return;

                    mipsData[mipIndex] = data;
                }

                // Get data boxes
                var dataBoxIndex = 0;
                var dataBoxes = new DataBox[newDesc.MipLevelCount * newDesc.ArraySize];
                for (var arrayIndex = 0; arrayIndex < newDesc.ArraySize; arrayIndex++)
                {
                    for (var mipIndex = 0; mipIndex < mipsCount; mipIndex++)
                    {

View on GitHub (pinned to 96fad776d2)