{"record":{"id":"a2e4c081a3ffd8eb","repo":"microsoft/aspire","slug":"integration-assets-file-assetsfilepath-was-not-found-after","errorCode":null,"errorMessage":"Integration assets file '{assetsFilePath}' was not found after build.","messagePattern":"Integration assets file '(.+?)' was not found after build\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Cli/Projects/PrebuiltAppHostServer.cs","lineNumber":1589,"sourceCode":"        }\n\n        return new ClosureMetadata(\n            NormalizeClosureMetadataValue(parts[0]),\n            NormalizeClosureMetadataValue(parts[1]),\n            NormalizeClosureMetadataValue(parts[2]),\n            NormalizeClosureMetadataValue(parts[3]));\n    }\n\n    private static string? NormalizeClosureMetadataValue(string value)\n    {\n        return string.IsNullOrWhiteSpace(value) ? null : value.Trim();\n    }\n\n    private static async Task<Dictionary<string, string>> ReadPackageFingerprintsAsync(string assetsFilePath, CancellationToken cancellationToken)\n    {\n        if (!File.Exists(assetsFilePath))\n        {\n            throw new InvalidOperationException($\"Integration assets file '{assetsFilePath}' was not found after build.\");\n        }\n\n        await using var stream = File.OpenRead(assetsFilePath);\n        using var document = await JsonDocument.ParseAsync(stream, cancellationToken: cancellationToken).ConfigureAwait(false);\n\n        var packageFingerprints = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);\n        if (!document.RootElement.TryGetProperty(\"libraries\", out var libraries))\n        {\n            return packageFingerprints;\n        }\n\n        foreach (var library in libraries.EnumerateObject())\n        {\n            cancellationToken.ThrowIfCancellationRequested();\n\n            if (!library.Value.TryGetProperty(\"type\", out var typeElement) ||\n                !string.Equals(typeElement.GetString(), \"package\", StringComparison.OrdinalIgnoreCase) ||\n                !library.Value.TryGetProperty(\"sha512\", out var sha512Element))","sourceCodeStart":1571,"sourceCodeEnd":1607,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Cli/Projects/PrebuiltAppHostServer.cs#L1571-L1607","documentation":"ReadPackageFingerprintsAsync parses the integration assets JSON file (produced by the bundled build) to collect package fingerprints. If the file is absent after the build, the build did not emit it, so the CLI throws InvalidOperationException naming the missing path. This is a post-build invariant: without the assets file there is no way to verify package integrity.","triggerScenarios":"Loading package fingerprints after the bundled restore/build when the build skipped or failed to emit the assets JSON; the computed assetsFilePath points to the wrong directory; an SDK/CLI version mismatch changed the assets file name or location.","commonSituations":"Build step silently failed or was skipped; intermediate output cleaned by a tool; running a newer CLI against an older bundle layout; misconfigured restoreDir so the path differs from where the build wrote output.","solutions":["Verify the file exists at the exact path in the message and inspect the restore/build output directory.","Re-run the bundled build and confirm it succeeds and emits the assets file.","Align CLI and SDK versions so both agree on the assets file name and location.","Clear stale restore output and rebuild from scratch."],"exampleFix":"// before\nvar fingerprints = await ReadPackageFingerprintsAsync(assetsFilePath, ct);\n// after: confirm the build emitted it\nif (!File.Exists(assetsFilePath)) { throw new InvalidOperationException($\"Bundle build did not emit assets file {assetsFilePath}\"); }","handlingStrategy":"validation","validationCode":"if (!File.Exists(assetsFilePath))\n    throw new InvalidOperationException($\"Assets file {assetsFilePath} missing — build did not emit it.\");","typeGuard":"static bool AssetsFileExists(string path) => File.Exists(path) && new FileInfo(path).Length > 0;","tryCatchPattern":"try { fingerprints = await ReadPackageFingerprintsAsync(assetsFilePath, ct); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"assets file\"))\n{ logger.LogError(ex, \"Assets file missing; rebuilding bundle\"); await RebuildAsync(ct); }","preventionTips":["Verify build success (exit code 0) before reading post-build artifacts.","Don't clean intermediate directories between build and consumption.","Keep CLI/SDK versions aligned so the assets file name/location matches expectations.","List the restore directory after build to confirm expected outputs exist."],"tags":["cli","file-not-found","build-artifacts","json"],"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"}