stride3d/stride · error · InvalidOperationException

Nothing to pack.

Error message

Nothing to pack.

What it means

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.

Solutions

  1. Guard the call: if objectIds.Length == 0, skip bundle creation instead of calling CreateBundle.
  2. Fix the query/filter that was supposed to populate objectIds so it returns the intended objects.
  3. For incremental flows, skip creating a new bundle when there is no delta and reuse the existing bundle.

Example fix

// before
CreateBundle(url, backend, objectIds, ...); // throws when empty
// after
if (objectIds.Length == 0)
{
    Console.WriteLine("No objects to pack; skipping bundle.");
    return;
}
CreateBundle(url, backend, objectIds, ...);
Defensive patterns

Strategy: validation

Validate before calling

if (objectIds == null || objectIds.Length == 0)
{
    logger.LogWarning("No objects to pack for {BundleUrl}; skipping.", bundleUrl);
    return;
}
CreateBundle(bundleUrl, backend, objectIds, disableCompressionIds, indexMap, dependencies, useIncrementalBundle);

Try / catch

try
{
    CreateBundle(bundleUrl, backend, objectIds, ...);
}
catch (InvalidOperationException ex) when (ex.Message == "Nothing to pack.")
{
    logger.LogWarning("Skipped empty bundle {BundleUrl}", bundleUrl);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at sources/core/Stride.Core.Serialization/Storage/BundleOdbBackend.cs:423

        // Read incremental bundles
        var incrementalBundles = result.IncrementalBundles;
        binaryReader.Serialize(ref incrementalBundles, ArchiveMode.Deserialize);

        // Read objects
        var objects = result.Objects;
        binaryReader.Serialize(ref objects, ArchiveMode.Deserialize);

        // Read assets
        var assets = result.Assets;
        binaryReader.Serialize(ref assets, ArchiveMode.Deserialize);

        return result;
    }

    public static void CreateBundle(string bundleUrl, IOdbBackend backend, ObjectId[] objectIds, ISet<ObjectId> disableCompressionIds, Dictionary<string, ObjectId> indexMap, IList<string> dependencies, bool useIncrementalBundle)
    {
        if (objectIds.Length == 0)
            throw new InvalidOperationException("Nothing to pack.");

        var objectsToIndex = new Dictionary<ObjectId, int>(objectIds.Length);

        var objects = new List<KeyValuePair<ObjectId, ObjectInfo>>();
        foreach (var objectId in objectIds)
        {
            objectsToIndex.Add(objectId, objects.Count);
            objects.Add(new KeyValuePair<ObjectId, ObjectInfo>(objectId, new ObjectInfo()));
        }

        var incrementalBundles = new List<ObjectId>();

        // If there is a .bundle, add incremental id before it
        var bundleExtensionLength = (bundleUrl.EndsWith(BundleExtension, StringComparison.OrdinalIgnoreCase) ? BundleExtension.Length : 0);

        // Early exit if package didn't change (header-check only)
        if (VirtualFileSystem.FileExists(bundleUrl))
        {

View on GitHub (pinned to 96fad776d2)