{"record":{"id":"f8bd366c4ed01bdd","repo":"stride3d/stride","slug":"nothing-to-pack","errorCode":null,"errorMessage":"Nothing to pack.","messagePattern":"Nothing to pack\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Serialization/Storage/BundleOdbBackend.cs","lineNumber":423,"sourceCode":"        // Read incremental bundles\n        var incrementalBundles = result.IncrementalBundles;\n        binaryReader.Serialize(ref incrementalBundles, ArchiveMode.Deserialize);\n\n        // Read objects\n        var objects = result.Objects;\n        binaryReader.Serialize(ref objects, ArchiveMode.Deserialize);\n\n        // Read assets\n        var assets = result.Assets;\n        binaryReader.Serialize(ref assets, ArchiveMode.Deserialize);\n\n        return result;\n    }\n\n    public static void CreateBundle(string bundleUrl, IOdbBackend backend, ObjectId[] objectIds, ISet<ObjectId> disableCompressionIds, Dictionary<string, ObjectId> indexMap, IList<string> dependencies, bool useIncrementalBundle)\n    {\n        if (objectIds.Length == 0)\n            throw new InvalidOperationException(\"Nothing to pack.\");\n\n        var objectsToIndex = new Dictionary<ObjectId, int>(objectIds.Length);\n\n        var objects = new List<KeyValuePair<ObjectId, ObjectInfo>>();\n        foreach (var objectId in objectIds)\n        {\n            objectsToIndex.Add(objectId, objects.Count);\n            objects.Add(new KeyValuePair<ObjectId, ObjectInfo>(objectId, new ObjectInfo()));\n        }\n\n        var incrementalBundles = new List<ObjectId>();\n\n        // If there is a .bundle, add incremental id before it\n        var bundleExtensionLength = (bundleUrl.EndsWith(BundleExtension, StringComparison.OrdinalIgnoreCase) ? BundleExtension.Length : 0);\n\n        // Early exit if package didn't change (header-check only)\n        if (VirtualFileSystem.FileExists(bundleUrl))\n        {","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Serialization/Storage/BundleOdbBackend.cs#L405-L441","documentation":"The static BundleOdbBackend.CreateBundle refuses to write a bundle when the objectIds array is empty, throwing InvalidOperationException 'Nothing to pack.'. A bundle must contain at least one object; creating an empty archive would produce an invalid/pointless file.","triggerScenarios":"Calling CreateBundle with an empty ObjectId[] — e.g. the source backend query returned no objects, all objects were filtered out, or incremental packaging found nothing new and the code still invoked CreateBundle.","commonSituations":"Build scripts that package a group whose assets were all deleted; content filters excluding everything; running incremental packaging on the first build with no delta.","solutions":["Guard the call: if objectIds.Length == 0, skip bundle creation instead of calling CreateBundle.","Fix the query/filter that was supposed to populate objectIds so it returns the intended objects.","For incremental flows, skip creating a new bundle when there is no delta and reuse the existing bundle."],"exampleFix":"// before\nCreateBundle(url, backend, objectIds, ...); // throws when empty\n// after\nif (objectIds.Length == 0)\n{\n    Console.WriteLine(\"No objects to pack; skipping bundle.\");\n    return;\n}\nCreateBundle(url, backend, objectIds, ...);","handlingStrategy":"validation","validationCode":"if (objectIds == null || objectIds.Length == 0)\n{\n    logger.LogWarning(\"No objects to pack for {BundleUrl}; skipping.\", bundleUrl);\n    return;\n}\nCreateBundle(bundleUrl, backend, objectIds, disableCompressionIds, indexMap, dependencies, useIncrementalBundle);","typeGuard":null,"tryCatchPattern":"try\n{\n    CreateBundle(bundleUrl, backend, objectIds, ...);\n}\ncatch (InvalidOperationException ex) when (ex.Message == \"Nothing to pack.\")\n{\n    logger.LogWarning(\"Skipped empty bundle {BundleUrl}\", bundleUrl);\n}","preventionTips":["Check the object query result count before invoking CreateBundle.","In incremental flows, skip bundle creation when the delta is empty.","Fix filters/group definitions that can select zero assets."],"tags":["bundles","empty-input","packaging"],"backgroundTag":"empty-result-set","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"}