{"record":{"id":"814656f4b1ef60d8","repo":"microsoft/aspire","slug":"failed-to-apply-launch-configuration-for-resource","errorCode":null,"errorMessage":"Failed to apply launch configuration for resource '{renderedResource.ModelResource.Name}'. Aspire does not retry launch configuration failures using DCP process fallback.","messagePattern":"Failed to apply launch configuration for resource '(.+?)'\\. Aspire does not retry launch configuration failures using DCP process fallback\\.","errorType":"exception","errorClass":"FailedToApplyEnvironmentException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting/Dcp/ExecutableCreator.cs","lineNumber":97,"sourceCode":"        }\n        catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested)\n        {\n            throw;\n        }\n        catch (FailedToApplyEnvironmentException ex)\n        {\n            resourceLogger.LogError(ex, \"{Message}\", ex.Message);\n            throw;\n        }\n        catch (ExecutableLaunchConfigurationException ex)\n        {\n            var failureMessage =\n                $\"Failed to apply launch configuration for resource '{renderedResource.ModelResource.Name}'. \" +\n                \"Aspire does not retry launch configuration failures using DCP process fallback.\";\n            // DcpExecutor avoids duplicating FailedToApplyEnvironmentException logs, so record the underlying\n            // launch producer failure on the resource logger before surfacing the actionable error.\n            resourceLogger.LogError(ex, \"{Message}\", failureMessage);\n            throw new FailedToApplyEnvironmentException(failureMessage, ex);\n        }\n        catch (Exception ex)\n        {\n            var failureMessage =\n                $\"Failed to create executable launch plan for resource '{renderedResource.ModelResource.Name}'. \" +\n                ex.Message;\n            // Report launch-planning failures with their specific cause without misclassifying recipe or invariant\n            // errors as IDE launch-configuration failures.\n            resourceLogger.LogError(ex, \"{Message}\", failureMessage);\n            throw new FailedToApplyEnvironmentException(failureMessage, ex);\n        }\n\n        Render(renderedResource, plan, configuration.PemCertificates, _logger);\n\n        await factory\n            .CreateDcpObjectsAsync([renderedResource.DcpResource], cancellationToken)\n            .ConfigureAwait(false);\n    }","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting/Dcp/ExecutableCreator.cs#L79-L115","documentation":"When building the executable launch plan fails with the designated launch-configuration exception type, ExecutableCreator.CreateObjectAsync logs the failure and rethrows it as FailedToApplyEnvironmentException with an explicit note that Aspire does not retry launch configuration failures via the DCP process fallback. This distinguishes deterministic launch configuration errors from transient ones so users know retrying will not help.","triggerScenarios":"recipes[0].Recipe.CreateLaunchPlanAsync (via ResolveLaunchPlanAsync) throwing the specific launch-configuration exception type caught by the handler — e.g., IDE launch configuration production failing for a project resource.","commonSituations":"A launchSettings.json/profile problem for project resources; an IDE launch profile that cannot be translated; misconfigured launch settings after SDK or IDE changes.","solutions":["Read the resource logs (resourceLogger.LogError) for the underlying exception captured as ex and fix it","For project resources, fix or regenerate launchSettings.json / launch profiles","If the launch recipe is custom, fix its CreateLaunchPlanAsync implementation; no DCP fallback retry will occur"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    await creator.CreateObjectAsync(renderedResource, resourceLogger, ct);\n}\ncatch (FailedToApplyEnvironmentException ex) when (ex.Message.Contains(\"does not retry\"))\n{\n    // Deterministic launch-config failure — fix launchSettings/profiles; retries will not help.\n}","preventionTips":["Keep launchSettings.json valid and regenerate it after SDK/IDE upgrades","Test project launch profiles outside the AppHost first","Do not rely on DCP fallback retries for launch configuration failures"],"tags":["launch","configuration","executable","dcp"],"backgroundTag":"missing-required-config","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"}