{"record":{"id":"11fdd397a60b4dc9","repo":"microsoft/aspire","slug":"failed-to-apply-configuration-to-executable-renderedresource","errorCode":null,"errorMessage":"Failed to apply configuration to executable {renderedResource.ModelResource.Name}","messagePattern":"Failed to apply configuration to executable (.+?)","errorType":"exception","errorClass":"FailedToApplyEnvironmentException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting/Dcp/ExecutableCreator.cs","lineNumber":63,"sourceCode":"        !DcpModelUtilities.ShouldDeferCreateForExplicitStart(\n            resource.ModelResource,\n            resource.DcpResource.Spec.Start);\n\n    public async Task CreateObjectAsync(\n        RenderedModelResource<Executable> renderedResource,\n        EmptyCreationContext context,\n        ILogger resourceLogger,\n        IDcpObjectFactory factory,\n        CancellationToken cancellationToken)\n    {\n        cancellationToken.ThrowIfCancellationRequested();\n\n        var configuration = await _configurationResolver\n            .ResolveAsync(renderedResource, resourceLogger, cancellationToken)\n            .ConfigureAwait(false);\n        if (configuration.Configuration.Exception is not null)\n        {\n            throw new FailedToApplyEnvironmentException(\n                $\"Failed to apply configuration to executable {renderedResource.ModelResource.Name}\",\n                configuration.Configuration.Exception);\n        }\n\n        ExecutableLaunchPlan plan;\n        try\n        {\n            plan = await ResolveLaunchPlanAsync(\n                renderedResource.ModelResource,\n                configuration.Configuration,\n                _configuration,\n                _distributedApplicationOptions,\n                _launchPolicy,\n                resourceLogger,\n                cancellationToken).ConfigureAwait(false);\n        }\n        catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested)\n        {","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting/Dcp/ExecutableCreator.cs#L45-L81","documentation":"Before creating a DCP Executable, Aspire resolves the resource's configuration (environment variables, args, etc.). If the resolution result carries an exception in configuration.Configuration.Exception, the resolved configuration is invalid, so this FailedToApplyEnvironmentException is thrown wrapping the inner exception. It signals that the resource model could not be turned into a concrete process configuration.","triggerScenarios":"A resource's configuration producer threw during ResolveAsync: bad endpoint references, a connection string property that failed to resolve, a value callback (IValueProvider) throwing, or an environment variable producer failing.","commonSituations":"Referencing an endpoint or connection string of a resource that failed to start; a custom IValueProvider/AddEnvironment callback throwing; missing referenced secret/parameter values.","solutions":["Inspect the InnerException (configuration.Configuration.Exception) for the real cause and fix that error first","Verify all referenced resources, endpoints, and parameters the failing executable depends on are valid and running","Check resource logs in the dashboard for the underlying configuration resolution error"],"exampleFix":"// before\nvar cs = builder.AddProject<Projects.Api>(\"api\").GetEndpoint(\"https\"); // endpoint that never exists\n// after\nvar cs = builder.AddProject<Projects.Api>(\"api\").WithEndpoint(\"https\", e => e.Scheme = \"https\"); // ensure the endpoint is defined","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    await creator.CreateObjectAsync(renderedResource, resourceLogger, ct);\n}\ncatch (FailedToApplyEnvironmentException ex)\n{\n    // Inspect ex.InnerException — the real configuration-resolution failure is there.\n    logger.LogError(ex.InnerException, \"Config resolution failed for {Resource}.\", resource.Name);\n}","preventionTips":["Verify all endpoint/connection references in the app model resolve before running","Wrap custom IValueProvider callbacks in validation so they fail with clear messages","Check the dashboard resource logs for the underlying resolution exception"],"tags":["configuration","environment","executable","dcp"],"backgroundTag":"config-type-mismatch","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"}