{"record":{"id":"174fbf8e8bbb6c17","repo":"microsoft/aspire","slug":"failed-to-start-aspire-dashboard-0","errorCode":null,"errorMessage":"Failed to start Aspire dashboard: {0}","messagePattern":"Failed to start Aspire dashboard: (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Cli/Profiling/ProfileCaptureService.cs","lineNumber":120,"sourceCode":"            var environmentVariables = CreateDashboardEnvironment();\n            layoutLease?.AddEnvironment(environmentVariables);\n\n            // Launch aspire-managed directly instead of calling `aspire dashboard run`. Calling\n            // back through the CLI being profiled would recursively apply --capture-profile and\n            // make the collector part of the measurement.\n            // Bind the collector dashboard to the Windows kill-on-close job so it cannot outlive a\n            // hard-killed CLI (OS-level backstop on top of the cross-platform watchdog). No-op off Windows.\n            dashboardProcess = await layoutProcessRunner.StartAsync(\n                managedPath,\n                dashboardArgs,\n                environmentVariables: environmentVariables,\n                options: processOptions,\n                killOnParentExit: true).ConfigureAwait(false);\n        }\n        catch (Exception ex)\n        {\n            layoutLease?.Dispose();\n            throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, DashboardCommandStrings.DashboardFailedToStart, ex.Message), ex);\n        }\n\n        var session = new ProfileCaptureSession(\n            options,\n            dashboardProcess,\n            httpClientFactory,\n            interactionService,\n            timeProvider,\n            logger,\n            s_profileDataTimeout,\n            s_pollInterval,\n            ProfileDataQuietPolls,\n            layoutLease);\n        try\n        {\n            await session.WaitForDashboardAsync(dashboardStartTimeout, pollInterval, cancellationToken).ConfigureAwait(false);\n            return session;\n        }","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Cli/Profiling/ProfileCaptureService.cs#L102-L138","documentation":"After resolving the dashboard binary, ProfileCaptureService.StartAsync launches aspire-managed (the dashboard process) with killOnParentExit enabled. Any exception thrown while starting that process — including Win32 spawn failures, missing-file errors, or runner-level failures — is caught and rethrown as this InvalidOperationException, wrapping the original message. The bundle layout lease is disposed before rethrowing.","triggerScenarios":"Calling ProfileCaptureService.StartAsync where layoutProcessRunner.StartAsync for aspire-managed throws: binary cannot be created as a process (CreateProcess failure), environment-variable setup fails, port binding configuration is invalid, or an underlying WindowsProcessInterop error (211-214) surfaces.","commonSituations":"Antivirus blocking aspire-managed execution; corrupted executable after partial extraction; invalid dashboard/OTLP URL configuration making the process arguments invalid; OS-level process-creation restrictions in hardened environments; low resource conditions preventing spawn.","solutions":["Inspect the inner exception message (appended after 'Failed to start Aspire dashboard:') to find the root cause.","Run 'aspire setup --force' or reinstall the CLI to repair a corrupted aspire-managed binary.","Check that the configured DashboardUrl/Otlp URLs are well-formed and their ports are free.","Verify antivirus/EDR policies allow executing the aspire-managed binary.","Retry the profiling capture once; transient spawn failures do occur."],"exampleFix":"// before: invalid URL config causing spawn arg failure\n--urls=http://:notaport\n// after: valid loopback URL with ephemeral port\n--urls=http://127.0.0.1:0","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    var session = await captureService.StartAsync(options, ct);\n}\ncatch (InvalidOperationException ex)\n{\n    // Inner message appended after 'Failed to start Aspire dashboard:' names the root cause.\n    logger.LogError(ex, \"Dashboard spawn failed: {Reason}\", ex.InnerException?.Message);\n}","preventionTips":["Verify the dashboard binary exists before starting a capture.","Use well-formed loopback URLs with free ports for dashboard/OTLP endpoints.","Check EDR/antivirus logs if spawn failures repeat."],"tags":["process-start","dashboard","cli","profiling"],"backgroundTag":"process-start-failed","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"}