microsoft/aspire · critical · InvalidOperationException

No Aspire AppHost server is available. Ensure the Aspire…

Error message

No Aspire AppHost server is available. Ensure the Aspire CLI is installed with a valid bundle layout, or reinstall using 'aspire setup --force'.

What it means

Thrown by AppHostServerProject.CreateAsync when no prebuilt Aspire AppHost server binary can be located: either no bundle layout was found, the layout has no managed path, or the file at that path doesn't exist. The CLI needs the bundled server executable to host the AppHost over RPC and cannot continue without it.

Solutions

  1. Run 'aspire setup --force' to reinstall/repair the bundle layout
  2. Reinstall the Aspire CLI completely (uninstall then install latest)
  3. If building from source, build/pack the CLI so the AppHost server is included in the layout
  4. Check the layout's managed path exists on disk and permissions allow execution

Example fix

// before
aspire run  // fails: no server in layout
// after
aspire setup --force
aspire run
Defensive patterns

Strategy: validation

Validate before calling

var layout = aspireLayoutLocator.TryLocate();
var serverPath = layout?.GetManagedPath();
if (serverPath is null || !File.Exists(serverPath))
    throw new InvalidOperationException("Run 'aspire setup --force' before starting an AppHost server session.");

Try / catch

try
{
    var server = await AppHostServerProject.CreateAsync(appPath, socketPath);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("No Aspire AppHost server"))
{
    // run 'aspire setup --force' then retry
}

Prevention

When it happens

Trigger: Calling CreateAsync when layout.GetManagedPath() is null, layout is null, or the server binary at the managed path is missing.

Common situations: Broken or partial aspire CLI installation, running from a dev build without the bundle layout, deleted artifacts after a cleanup, or a corrupted install that skipped the server payload.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


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

Appendix: source

Thrown at src/Aspire.Cli/Projects/AppHostServerProject.cs:73

                processExecutionFactory,
                environment,
                loggerFactory.CreateLogger<DotNetBasedAppHostServerProject>(),
                logFilePath: executionContext.LogFilePath,
                restoreRootConfigDirectory: restoreRootConfigDirectory);
        }

        // Priority 2: Ensure bundle is extracted and check for layout
        var layoutLease = await bundleService.EnsureExtractedAndAcquireLayoutAsync("cli", "apphost-server", cancellationToken);
        var layout = layoutLease?.Layout;

        // Priority 3: Check if we have a bundle layout with a pre-built AppHost server
        if (layout is not null && layout.GetManagedPath() is string serverPath && File.Exists(serverPath))
        {
            return CreatePrebuiltAppHostServer(appPath, socketPath, layout, layoutLease);
        }

        layoutLease?.Dispose();
        throw new InvalidOperationException(
            "No Aspire AppHost server is available. Ensure the Aspire CLI is installed " +
            "with a valid bundle layout, or reinstall using 'aspire setup --force'.");
    }

    internal PrebuiltAppHostServer CreatePrebuiltAppHostServer(
        string appPath,
        string socketPath,
        LayoutConfiguration layout,
        BundleLayoutLease? layoutLease)
    {
        try
        {
            return new PrebuiltAppHostServer(
                appPath,
                socketPath,
                layout,
                bundleNuGetService,
                dotNetCliRunner,

View on GitHub (pinned to 25830f84bd)