CoplayDev/unity-mcp · error · ArgumentException

Package Exporting failed: provided export paths are empty or

Error message

Package Exporting failed: provided export paths are empty or only contain empty folders

What it means

Thrown after GetGuids resolves zero GUIDs from the export paths, or when the paths contain only empty folders. Unlike error 101 (which checks array emptiness), this fires when paths exist but yield no exportable Unity assets. It prevents creating an empty .unitypackage.

Source

Thrown at TestProjects/AssetStoreUploads/Packages/com.unity.asset-store-tools/Editor/Exporter/LegacyPackageExporter.cs:45

            if (_legacyExportSettings.ExportPaths == null || _legacyExportSettings.ExportPaths.Length == 0)
                throw new ArgumentException("Export paths array cannot be empty");
        }

        protected override async Task<PackageExporterResult> ExportImpl()
        {
            return await this.Export();
        }

        private async new Task<PackageExporterResult> Export()
        {
            ASDebug.Log("Using native package exporter");

            try
            {
                var guids = GetGuids(_legacyExportSettings.ExportPaths, out bool onlyFolders);

                if (guids.Length == 0 || onlyFolders)
                    throw new ArgumentException("Package Exporting failed: provided export paths are empty or only contain empty folders");

                string exportMethod = ExportMethodWithoutDependencies;
                if (_legacyExportSettings.IncludeDependencies)
                    exportMethod = ExportMethodWithDependencies;

                var split = exportMethod.Split('.');
                var assembly = Assembly.Load(split[0]); // UnityEditor
                var typeName = $"{split[0]}.{split[1]}"; // UnityEditor.PackageUtility
                var methodName = split[2]; // ExportPackage or ExportPackageAndPackageManagerManifest

                var type = assembly.GetType(typeName);
                var method = type.GetMethod(methodName, BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public,
                    null, new Type[] { typeof(string[]), typeof(string) }, null);

                ASDebug.Log("Invoking native export method");

                method?.Invoke(null, new object[] { guids, _legacyExportSettings.OutputFilename });

View on GitHub (pinned to c21bf496bc)

Solutions

  1. Verify the export paths actually contain Unity-imported assets (check the AssetDatabase, not just the filesystem).
  2. Remove or replace empty-only folders from ExportPaths.
  3. Re-import the folder in Unity (right-click > Reimport) to ensure AssetDatabase has registered the assets.

Example fix

// before
var guids = GetGuids(_legacyExportSettings.ExportPaths, out bool onlyFolders);
if (guids.Length == 0 || onlyFolders)
    throw new ArgumentException("Package Exporting failed: provided export paths are empty or only contain empty folders");

// after — report which paths are problematic
var guids = GetGuids(_legacyExportSettings.ExportPaths, out bool onlyFolders);
if (guids.Length == 0 || onlyFolders)
{
    var empties = _legacyExportSettings.ExportPaths.Where(p => !AssetDatabase.FindAssets("", new[] { p }).Any());
    throw new ArgumentException($"No assets found in: {string.Join(", ", empties)}");
}
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check: verify paths contain actual assets before exporting
foreach (var path in exportPaths)
{
    var guids = AssetDatabase.FindAssets("", new[] { path });
    if (guids.Length == 0)
        Debug.LogWarning($"Path '{path}' contains no assets and will cause export failure.");
}

Try / catch

try
{
    await exporter.Export();
}
catch (ArgumentException ex) when (ex.Message.Contains("empty or only contain empty folders"))
{
    Debug.LogError("Export failed: the selected paths contain no assets. Verify your folders are not empty.");
}

Prevention

When it happens

Trigger: GetGuids(_legacyExportSettings.ExportPaths, out bool onlyFolders) returns an empty array, or onlyFolders is true — meaning AssetDatabase found no assets (only empty directories) under the given paths.

Common situations: Export paths point to folders that contain only subfolders with no assets; assets were deleted or moved after paths were configured; .meta files exist but the actual asset files are missing; folders contain only ignored file types.

Related errors


AI-assisted analysis of CoplayDev/unity-mcp@c21bf496bc (2026-08-13). Data as JSON: /api/errors/090610e85cdfd9c0. Report an issue: GitHub.