{"record":{"id":"0bbe9b2e818fc9db","repo":"microsoft/aspire","slug":"internalerror-0bbe9b","errorCode":"InternalError","errorMessage":"No Aspire AppHost is currently running. To use Aspire MCP tools, you must first start an Aspire application by running 'aspire start' in your AppHost project directory. Once the application is running, the MCP tools will be able to connect to the dashboard and execute commands.","messagePattern":"No Aspire AppHost is currently running\\. To use Aspire MCP tools, you must first start an Aspire application by running 'aspire start' in your AppHost project directory\\. Once the application is running, the MCP tools will be able to connect to the dashboard and execute commands\\.","errorType":"error_code","errorClass":"McpProtocolException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Cli/Mcp/Tools/ExecuteResourceCommandTool.cs","lineNumber":90,"sourceCode":"            throw new McpProtocolException(\"Arguments 'resourceName' and 'commandName' cannot be empty.\", McpErrorCode.InvalidParams);\n        }\n\n        JsonNode? commandArguments = null;\n        if (toolArguments.TryGetValue(\"arguments\", out var commandArgumentsElement))\n        {\n            if (commandArgumentsElement.ValueKind != JsonValueKind.Object)\n            {\n                throw new McpProtocolException(\"Argument 'arguments' must be a JSON object.\", McpErrorCode.InvalidParams);\n            }\n\n            commandArguments = CreateCommandArguments(commandArgumentsElement);\n        }\n\n        var connection = await AppHostConnectionHelper.GetSelectedConnectionAsync(auxiliaryBackchannelMonitor, logger, cancellationToken).ConfigureAwait(false);\n        if (connection is null)\n        {\n            logger.LogWarning(\"No Aspire AppHost is currently running\");\n            throw new McpProtocolException(McpErrorMessages.NoAppHostRunning, McpErrorCode.InternalError);\n        }\n\n        // Check if the resource is excluded from MCP before executing commands.\n        var excludedResult = await McpToolHelpers.CheckResourceExcludedAsync(connection, resourceName, cancellationToken).ConfigureAwait(false);\n        if (excludedResult is not null)\n        {\n            return excludedResult;\n        }\n\n        try\n        {\n            logger.LogDebug(\"Executing command '{CommandName}' on resource '{ResourceName}' via backchannel\", commandName, resourceName);\n\n            var response = await connection.ExecuteResourceCommandAsync(\n                resourceName,\n                commandName,\n                new ExecuteResourceCommandOptions\n                {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Cli/Mcp/Tools/ExecuteResourceCommandTool.cs#L72-L108","documentation":"MCP tools run inside the Aspire CLI and operate via a backchannel connection to the running AppHost's dashboard. When no AppHost is running (GetSelectedConnectionAsync returns null), the tool throws McpProtocolException with InternalError and a message instructing the user to run 'aspire start' first.","triggerScenarios":"Calling execute_resource_command (or any MCP tool using AppHostConnectionHelper) while no Aspire AppHost application is running or connected to the dashboard/backchannel.","commonSituations":"MCP client configured globally without an active aspire session; AppHost stopped or crashed after client connected; running MCP tools outside the AppHost project directory; multi-AppHost setups where the wrong/none connection is selected.","solutions":["Start the AppHost: run 'aspire start' (or the apphost) in your AppHost project directory, then retry","Verify the AppHost is actually running and its dashboard is up","Reconnect/restart the MCP client so it discovers the new backchannel connection","Ensure you are in the correct AppHost project directory if multiple exist"],"exampleFix":"// before (no session)\ncallTool(\"execute_resource_command\", args);\n// after\n// 1) aspire start   (in the AppHost project directory)\n// 2) retry the tool call\ncallTool(\"execute_resource_command\", args);","handlingStrategy":"retry","validationCode":"// before invoking MCP tools, confirm a session exists\nvar connected = await helper.TryGetSelectedConnectionAsync(monitor, logger, ct);\nif (connected is null) { /* prompt user to run 'aspire start' */ }","typeGuard":null,"tryCatchPattern":"try { await tool.CallToolAsync(ctx); }\ncatch (McpProtocolException ex) when (ex.Message.Contains(\"No Aspire AppHost\"))\n{ // start the AppHost, wait for dashboard, then retry with backoff }","preventionTips":["Start the AppHost before launching/using MCP tooling","Health-check the dashboard/backchannel connection before tool calls","Retry with backoff after starting the AppHost; connections appear asynchronously","Scope MCP client config to workspaces that actually have a running AppHost"],"tags":["mcp","apphost","connection"],"backgroundTag":"connection-refused","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"}