microsoft/aspire · critical · InvalidOperationException
aspire-managed not found in layout.
Error message
aspire-managed not found in layout.
What it means
PrebuiltAppHostServer.GetServerPath resolves the aspire-managed server binary from the CLI layout. If the layout reports no managed path or the file does not exist on disk, the method throws, because the prebuilt AppHost server cannot run without it.
Solutions
- Reinstall the Aspire CLI so the layout is rebuilt with aspire-managed present
- Verify the layout directory actually contains the aspire-managed binary and restore it if missing
- Check antivirus/quarantine logs if the file existed previously but disappeared
Example fix
// before var serverPath = server.GetServerPath(); // throws: missing in layout // after // reinstall CLI to repair layout $ curl -fsSL https://aspire.dev/install.sh | bash var serverPath = server.GetServerPath();
Defensive patterns
Strategy: fallback
Validate before calling
var managedPath = layout.GetManagedPath();
if (managedPath is null || !File.Exists(managedPath))
throw new InvalidOperationException("aspire-managed missing; reinstall the Aspire CLI"); Type guard
bool LayoutHasManagedServer(ILayout layout) => layout.GetManagedPath() is { } p && File.Exists(p); Try / catch
try { path = server.GetServerPath(); }
catch (InvalidOperationException ex) when (ex.Message.Contains("aspire-managed not found"))
{
// reinstall CLI or use fallback server path
} Prevention
- Reinstall the CLI after manual edits to its install directory
- Exclude the CLI install location from antivirus quarantine/cleanup
- Verify the install layout after upgrading the CLI before launching AppHosts
When it happens
Trigger: Calling GetServerPath on a layout produced by an incomplete/corrupt CLI install, or after the layout directory was partially deleted or cleaned up while the CLI is running.
Common situations: Broken or hand-mangled CLI installation, antivirus quarantining the managed binary, staging-directory cleanup removing the file before it is used, or an out-of-date layout manifest.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- aspire-managed not found in layout.
- Bundle extraction failed. Run 'aspire setup --force' to…
- Bundle layout not found. Cannot perform NuGet search in…
- No Aspire AppHost server is available. Ensure the Aspire…
- Already connected to AppHost backchannel.
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/99f098acf41f4d14.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Cli/Projects/PrebuiltAppHostServer.cs:137
/// <inheritdoc />
public string AppDirectoryPath => _appDirectoryPath;
internal string? SelectedProjectLayoutFingerprint => _selectedProjectLayout?.Fingerprint;
internal string? SelectedProjectLayoutPath => _selectedProjectLayout?.LayoutPath;
internal string? IntegrationProbeManifestPath => _integrationProbeManifestPath;
/// <summary>
/// Gets the path to the aspire-managed executable (used as the server).
/// </summary>
public string GetServerPath()
{
var managedPath = _layout.GetManagedPath();
if (managedPath is null || !File.Exists(managedPath))
{
throw new InvalidOperationException("aspire-managed not found in layout.");
}
return managedPath;
}
/// <inheritdoc />
public async Task<AppHostServerPrepareResult> PrepareAsync(
string sdkVersion,
IEnumerable<IntegrationReference> integrations,
string? requestedChannel = null,
string? packageSourceOverride = null,
CancellationToken cancellationToken = default)
{
var integrationList = integrations.ToList();
var packageRefs = integrationList.Where(r => r.IsPackageReference).ToList();
var projectRefs = integrationList.Where(r => r.IsProjectReference).ToList();
// Lifted to outer scope so the failure footer reflects the source actually used by
// restore — including the auto-discovered local hive resolved byView on GitHub (pinned to 25830f84bd)