microsoft/aspire · error · InvalidOperationException

Manifest creation failed

Error message

Manifest creation failed: {error}

What it means

After a successful restore, RestorePackagesAsync runs `aspire-managed nuget manifest` to generate an IntegrationPackageProbeManifest from project.assets.json. If that manifest-creation step exits non-zero, the method logs exit code/stderr/stdout and throws InvalidOperationException 'Manifest creation failed: {error}'.

Solutions

  1. Inspect the logged stderr/stdout for the manifest step's underlying error
  2. Delete the restore cache directory (hash-named under the working directory's cache) to force a clean restore + manifest
  3. Check write permissions on the restore/obj directories
  4. Update the CLI so aspire-managed and CLI agree on the manifest format
Defensive patterns

Strategy: retry

Validate before calling

// After restore, confirm assets file exists before manifest step would run
if (!File.Exists(Path.Combine(restoreDir, "obj", "project.assets.json")))
{
    // restore was incomplete; clean and retry
}

Try / catch

try
{
    await service.RestorePackagesAsync(packages, workingDir);
}
catch (InvalidOperationException ex) when (ex.Message.StartsWith("Manifest creation failed"))
{
    // delete the hash-named restore cache dir and retry restore + manifest
}

Prevention

When it happens

Trigger: The second aspire-managed invocation (`nuget manifest --assets <obj>/project.assets.json --output <manifestPath>`) exits non-zero — typically because project.assets.json is missing/corrupt from the preceding restore, or the output path is unwritable.

Common situations: Restore produced no or partial project.assets.json; file lock or permission issue in the restore cache directory; version mismatch between CLI and aspire-managed producing incompatible manifest arguments.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/3f4d71338838c326. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Cli/NuGet/BundleNuGetService.cs:258

            manifestArgs,
            environmentVariables: environmentVariables,
            // Same rationale as the restore step above: keep this aspire-managed helper from outliving a
            // hard-killed CLI (Windows kill-on-close job, or the cooperative watchdog on other hosts).
            killOnParentExit: true,
            ct: ct);

        // Log stderr at debug level for diagnostics
        if (!string.IsNullOrWhiteSpace(error))
        {
            _logger.LogDebug("NuGetHelper manifest stderr: {Error}", error);
        }

        if (exitCode != 0)
        {
            _logger.LogError("Manifest creation failed with exit code {ExitCode}", exitCode);
            _logger.LogError("Manifest creation stderr: {Error}", error);
            _logger.LogError("Manifest creation stdout: {Output}", output);
            throw new InvalidOperationException($"Manifest creation failed: {error}");
        }

        _logger.LogDebug("Package manifest created at {Path}", manifestPath);
        return manifestPath;
    }

    private static bool TryValidatePackageManifest(string manifestPath, ILogger logger)
    {
        try
        {
            _ = IntegrationPackageProbeManifest.Load(manifestPath);
            return true;
        }
        catch (Exception ex) when (ex is InvalidOperationException or JsonException or IOException or UnauthorizedAccessException)
        {
            logger.LogDebug(ex, "Cached package manifest {ManifestPath} is invalid and will be regenerated.", manifestPath);
            return false;
        }

View on GitHub (pinned to 25830f84bd)