{"record":{"id":"e02441d1254d6bea","repo":"microsoft/aspire","slug":"integration-closure-manifest-file-filepath-was-not-found","errorCode":null,"errorMessage":"Integration closure manifest file '{filePath}' was not found after build.","messagePattern":"Integration closure manifest file '(.+?)' was not found after build\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Cli/Projects/PrebuiltAppHostServer.cs","lineNumber":1556,"sourceCode":"    /// Reads the project reference assembly names written by the MSBuild target during build.\n    /// </summary>\n    private async Task<List<string>> ReadProjectRefAssemblyNamesAsync(string filePath, CancellationToken cancellationToken)\n    {\n        if (!File.Exists(filePath))\n        {\n            _logger.LogWarning(\"Project reference assembly names file not found at {Path}\", filePath);\n            return [];\n        }\n\n        var lines = await File.ReadAllLinesAsync(filePath, cancellationToken);\n        return lines.Where(l => !string.IsNullOrWhiteSpace(l)).Select(l => l.Trim()).ToList();\n    }\n\n    private static async Task<List<string>> ReadManifestFileAsync(string filePath, CancellationToken cancellationToken)\n    {\n        if (!File.Exists(filePath))\n        {\n            throw new InvalidOperationException($\"Integration closure manifest file '{filePath}' was not found after build.\");\n        }\n\n        var lines = await File.ReadAllLinesAsync(filePath, cancellationToken).ConfigureAwait(false);\n        return lines.Where(static line => !string.IsNullOrWhiteSpace(line)).Select(static line => line.Trim()).ToList();\n    }\n\n    private static ClosureMetadata ParseClosureMetadata(string line)\n    {\n        ArgumentNullException.ThrowIfNull(line);\n\n        var parts = line.Split('|', 4);\n        if (parts.Length != 4)\n        {\n            throw new InvalidOperationException($\"Integration closure metadata line '{line}' is invalid.\");\n        }\n\n        return new ClosureMetadata(\n            NormalizeClosureMetadataValue(parts[0]),","sourceCodeStart":1538,"sourceCodeEnd":1574,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Cli/Projects/PrebuiltAppHostServer.cs#L1538-L1574","documentation":"ReadManifestFileAsync loads one of the integration closure manifest files (sources/metadata/targets) after the bundled build completes. If the expected file does not exist on disk, the build did not produce the manifest the CLI relies on, so it throws InvalidOperationException with the missing path. The count is: this is a post-build invariant check, not a user input error.","triggerScenarios":"Reading closure sources/metadata/targets manifests after running the bundle build when the build failed silently, wrote output to a different directory, or was skipped; passing a wrong restoreDir so the expected path under it doesn't exist.","commonSituations":"Build step suppressed or failed but exit code not surfaced; antivirus/cleanup tools deleting intermediate files; out-of-date CLI expecting a manifest name changed by a newer SDK; running from a different working directory so relative restore paths resolve elsewhere.","solutions":["Re-run the bundled build and check its output/exit code for failures before loading manifests.","Verify the manifest file exists at the exact path shown in the message (ls the restoreDir).","Confirm the CLI and SDK versions agree on manifest file names and output layout; upgrade or align versions.","Clear the restore directory and rebuild to rule out stale partial output."],"exampleFix":"// before: assume build succeeded, read manifest directly\nvar sources = await ReadManifestFileAsync(closureSourcesPath, ct);\n// after: check build result first\nif (buildResult.ExitCode != 0) { throw new InvalidOperationException($\"Bundle build failed: {buildResult.Output}\"); }","handlingStrategy":"validation","validationCode":"if (!File.Exists(closureSourcesPath) || !File.Exists(closureMetadataPath) || !File.Exists(closureTargetsPath))\n    throw new InvalidOperationException($\"Closure manifests missing under {restoreDir}; build did not complete.\");","typeGuard":"static bool ClosureManifestsExist(string dir) =>\n    File.Exists(Path.Combine(dir, \"closure.sources.txt\")) &&\n    File.Exists(Path.Combine(dir, \"closure.metadata.txt\")) &&\n    File.Exists(Path.Combine(dir, \"closure.targets.txt\"));","tryCatchPattern":"try { await server.LoadAsync(ct); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"was not found after build\"))\n{ logger.LogError(ex, \"Build did not emit manifest; re-running build\"); await RebuildAsync(ct); }","preventionTips":["Check the bundled build's exit code before consuming its outputs.","Exclude restore/interim directories from antivirus and cleanup jobs.","Keep CLI and SDK versions aligned with the bundle layout.","Rebuild from a clean restore directory when in doubt."],"tags":["cli","file-not-found","build-artifacts","manifest"],"backgroundTag":"file-not-found","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}