{"record":{"id":"183d80fa0f5a6a05","repo":"microsoft/aspire","slug":"failed-to-create-executable-launch-plan-for-resource","errorCode":null,"errorMessage":"Failed to create executable launch plan for resource '{renderedResource.ModelResource.Name}'. {ex.Message}","messagePattern":"Failed to create executable launch plan for resource '(.+?)'\\. (.+?)","errorType":"exception","errorClass":"FailedToApplyEnvironmentException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting/Dcp/ExecutableCreator.cs","lineNumber":107,"sourceCode":"        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    }\n\n    internal static async Task<ExecutableLaunchPlan> ResolveLaunchPlanAsync(\n        IResource resource,\n        IExecutionConfigurationResult executionConfiguration,\n        IConfiguration configuration,\n        DistributedApplicationOptions distributedApplicationOptions,\n        ExecutableLaunchPolicy launchPolicy,\n        ILogger resourceLogger,\n        CancellationToken cancellationToken)\n    {","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting/Dcp/ExecutableCreator.cs#L89-L125","documentation":"When building the executable launch plan fails with an unexpected (non-launch-configuration) exception, ExecutableCreator.CreateObjectAsync wraps it in FailedToApplyEnvironmentException, prefixing the original message. The comment notes this deliberately reports launch-planning failures with their specific cause without misclassifying them as IDE launch-configuration failures.","triggerScenarios":"Any exception other than the launch-configuration exception thrown during plan creation in ResolveLaunchPlanAsync — e.g., the launch policy decision logic throwing, or the recipe's CreateLaunchPlanAsync failing for a non-IDE reason.","commonSituations":"Custom ExecutableLaunchRecipeAnnotation recipes throwing; internal invariant failures during launch policy evaluation; bugs in resource-type integrations.","solutions":["Read the appended ex.Message in the exception and the resource logs to identify the specific cause","If a custom launch recipe is registered, debug/fix its CreateLaunchPlanAsync","Verify the resource's annotations are intact (exactly one launch recipe, valid launch policy)"],"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.StartsWith(\"Failed to create executable launch plan\"))\n{\n    // ex.InnerException + appended message identify the specific planning failure.\n    logger.LogError(ex.InnerException, \"Launch plan creation failed.\");\n}","preventionTips":["Ensure custom launch recipes handle all input states without throwing","Keep Aspire.Hosting and integration packages version-aligned","Log and validate annotations added by custom resource builders"],"tags":["launch","plan","executable","dcp"],"backgroundTag":"internal-invariant-violation","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"}