{"record":{"id":"d5fb1e5e1176cc38","repo":"microsoft/aspire","slug":"no-aspire-apphost-server-is-available-ensure-the-aspire-cli","errorCode":null,"errorMessage":"No Aspire AppHost server is available. Ensure the Aspire CLI is installed with a valid bundle layout, or reinstall using 'aspire setup --force'.","messagePattern":"No Aspire AppHost server is available\\. Ensure the Aspire CLI is installed with a valid bundle layout, or reinstall using 'aspire setup --force'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/Aspire.Cli/Projects/AppHostServerProject.cs","lineNumber":73,"sourceCode":"                processExecutionFactory,\n                environment,\n                loggerFactory.CreateLogger<DotNetBasedAppHostServerProject>(),\n                logFilePath: executionContext.LogFilePath,\n                restoreRootConfigDirectory: restoreRootConfigDirectory);\n        }\n\n        // Priority 2: Ensure bundle is extracted and check for layout\n        var layoutLease = await bundleService.EnsureExtractedAndAcquireLayoutAsync(\"cli\", \"apphost-server\", cancellationToken);\n        var layout = layoutLease?.Layout;\n\n        // Priority 3: Check if we have a bundle layout with a pre-built AppHost server\n        if (layout is not null && layout.GetManagedPath() is string serverPath && File.Exists(serverPath))\n        {\n            return CreatePrebuiltAppHostServer(appPath, socketPath, layout, layoutLease);\n        }\n\n        layoutLease?.Dispose();\n        throw new InvalidOperationException(\n            \"No Aspire AppHost server is available. Ensure the Aspire CLI is installed \" +\n            \"with a valid bundle layout, or reinstall using 'aspire setup --force'.\");\n    }\n\n    internal PrebuiltAppHostServer CreatePrebuiltAppHostServer(\n        string appPath,\n        string socketPath,\n        LayoutConfiguration layout,\n        BundleLayoutLease? layoutLease)\n    {\n        try\n        {\n            return new PrebuiltAppHostServer(\n                appPath,\n                socketPath,\n                layout,\n                bundleNuGetService,\n                dotNetCliRunner,","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Cli/Projects/AppHostServerProject.cs#L55-L91","documentation":"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.","triggerScenarios":"Calling CreateAsync when layout.GetManagedPath() is null, layout is null, or the server binary at the managed path is missing.","commonSituations":"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.","solutions":["Run 'aspire setup --force' to reinstall/repair the bundle layout","Reinstall the Aspire CLI completely (uninstall then install latest)","If building from source, build/pack the CLI so the AppHost server is included in the layout","Check the layout's managed path exists on disk and permissions allow execution"],"exampleFix":"// before\naspire run  // fails: no server in layout\n// after\naspire setup --force\naspire run","handlingStrategy":"validation","validationCode":"var layout = aspireLayoutLocator.TryLocate();\nvar serverPath = layout?.GetManagedPath();\nif (serverPath is null || !File.Exists(serverPath))\n    throw new InvalidOperationException(\"Run 'aspire setup --force' before starting an AppHost server session.\");","typeGuard":null,"tryCatchPattern":"try\n{\n    var server = await AppHostServerProject.CreateAsync(appPath, socketPath);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"No Aspire AppHost server\"))\n{\n    // run 'aspire setup --force' then retry\n}","preventionTips":["Run 'aspire setup --force' after installing or upgrading the CLI","Avoid cleaning artifacts the bundle layout depends on","Verify the install completed fully (server payload present)","Check layout paths when running from dev/source builds"],"tags":["cli","setup","missing-binary"],"backgroundTag":"missing-dependency","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"}