{"record":{"id":"7cd92867d093669c","repo":"stride3d/stride","slug":"data-chunk-has-invalid-size","errorCode":null,"errorMessage":"Data chunk has invalid size.","messagePattern":"Data chunk has invalid size\\.","errorType":"exception","errorClass":"ContentStreamingException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Rendering/Streaming/StreamingTexture.cs","lineNumber":303,"sourceCode":"                // Setup texture description\n                TextureDescription newDesc = description;\n                var newHighestResidentMipIndex = TotalMipLevels - mipsCount;\n                newDesc.MipLevelCount = mipsCount;\n                var topMip = mipInfos[description.MipLevels - newDesc.MipLevelCount];\n                newDesc.Width = topMip.Width;\n                newDesc.Height = topMip.Height;\n\n                // Load chunks\n                var mipsData = new IntPtr[mipsCount];\n                for (var mipIndex = 0; mipIndex < mipsCount; mipIndex++)\n                {\n                    var totalMipIndex = newHighestResidentMipIndex + mipIndex;\n                    var chunk = Storage.GetChunk(totalMipIndex);\n                    if (chunk == null)\n                        throw new ContentStreamingException(\"Data chunk is missing.\", Storage);\n\n                    if (chunk.Size != mipInfos[totalMipIndex].TotalSize)\n                        throw new ContentStreamingException(\"Data chunk has invalid size.\", Storage);\n\n                    var data = chunk.GetData(fileProvider);\n                    if (!chunk.IsLoaded)\n                        throw new ContentStreamingException(\"Data chunk is not loaded.\", Storage);\n\n                    if (cancellationToken.IsCancellationRequested)\n                        return;\n\n                    mipsData[mipIndex] = data;\n                }\n\n                // Get data boxes\n                var dataBoxIndex = 0;\n                var dataBoxes = new DataBox[newDesc.MipLevelCount * newDesc.ArraySize];\n                for (var arrayIndex = 0; arrayIndex < newDesc.ArraySize; arrayIndex++)\n                {\n                    for (var mipIndex = 0; mipIndex < mipsCount; mipIndex++)\n                    {","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Rendering/Streaming/StreamingTexture.cs#L285-L321","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Do a clean rebuild of the texture assets so chunk sizes match the current mipInfos","Delete stale compiled assets/storage and redeploy content from the same build","Verify the ImageDescription passed to StreamingTexture.Init matches the asset's compiled description (format, dimensions, mip count)","Check version control/deployment scripts for partially updated content folders"],"exampleFix":"// before\nstreamingTexture.Init(provider, oldStorage, ref description); // sizes mismatch old chunks\n// after\nif (chunk.Size == mipInfos[totalMipIndex].TotalSize)\n    streamingTexture.Init(provider, storage, ref description);\nelse\n    await RecompileAndReloadAsync(assetUrl);","handlingStrategy":"validation","validationCode":"foreach (var mip in mips)\n    if (storage.GetChunk(mip.Index)?.Size != mip.TotalSize)\n        Logger.Error($\"Chunk size mismatch on mip {mip.Index}; rebuild content.\");","typeGuard":null,"tryCatchPattern":"try\n{\n    await StreamAsync(mipIndex);\n}\ncatch (ContentStreamingException)\n{\n    Logger.Warning(\"Chunk size mismatch; scheduling content rebuild\");\n}","preventionTips":["Clean-rebuild content after changing texture format/size","Deploy header and chunk files from the same build","Version-check storage files at startup"],"tags":["streaming","textures","corruption"],"backgroundTag":"checksum-mismatch","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}