{"record":{"id":"3f4d71338838c326","repo":"microsoft/aspire","slug":"manifest-creation-failed-error","errorCode":null,"errorMessage":"Manifest creation failed: {error}","messagePattern":"Manifest creation failed: (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Cli/NuGet/BundleNuGetService.cs","lineNumber":258,"sourceCode":"            manifestArgs,\n            environmentVariables: environmentVariables,\n            // Same rationale as the restore step above: keep this aspire-managed helper from outliving a\n            // hard-killed CLI (Windows kill-on-close job, or the cooperative watchdog on other hosts).\n            killOnParentExit: true,\n            ct: ct);\n\n        // Log stderr at debug level for diagnostics\n        if (!string.IsNullOrWhiteSpace(error))\n        {\n            _logger.LogDebug(\"NuGetHelper manifest stderr: {Error}\", error);\n        }\n\n        if (exitCode != 0)\n        {\n            _logger.LogError(\"Manifest creation failed with exit code {ExitCode}\", exitCode);\n            _logger.LogError(\"Manifest creation stderr: {Error}\", error);\n            _logger.LogError(\"Manifest creation stdout: {Output}\", output);\n            throw new InvalidOperationException($\"Manifest creation failed: {error}\");\n        }\n\n        _logger.LogDebug(\"Package manifest created at {Path}\", manifestPath);\n        return manifestPath;\n    }\n\n    private static bool TryValidatePackageManifest(string manifestPath, ILogger logger)\n    {\n        try\n        {\n            _ = IntegrationPackageProbeManifest.Load(manifestPath);\n            return true;\n        }\n        catch (Exception ex) when (ex is InvalidOperationException or JsonException or IOException or UnauthorizedAccessException)\n        {\n            logger.LogDebug(ex, \"Cached package manifest {ManifestPath} is invalid and will be regenerated.\", manifestPath);\n            return false;\n        }","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Cli/NuGet/BundleNuGetService.cs#L240-L276","documentation":"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}'.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the logged stderr/stdout for the manifest step's underlying error","Delete the restore cache directory (hash-named under the working directory's cache) to force a clean restore + manifest","Check write permissions on the restore/obj directories","Update the CLI so aspire-managed and CLI agree on the manifest format"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// After restore, confirm assets file exists before manifest step would run\nif (!File.Exists(Path.Combine(restoreDir, \"obj\", \"project.assets.json\")))\n{\n    // restore was incomplete; clean and retry\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    await service.RestorePackagesAsync(packages, workingDir);\n}\ncatch (InvalidOperationException ex) when (ex.Message.StartsWith(\"Manifest creation failed\"))\n{\n    // delete the hash-named restore cache dir and retry restore + manifest\n}","preventionTips":["Treat restore-cache corruption promptly: clear the cache dir on manifest errors","Ensure no concurrent processes share the same restore cache without the CLI's file lock","Keep CLI/aspire-managed versions aligned to avoid manifest schema mismatches","Grant write permissions to the workspace cache directories"],"tags":["nuget","manifest","bundle","cli"],"backgroundTag":"http-request-failed","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}