microsoft/aspire · error · FailedToApplyEnvironmentException
Failed to apply configuration to executable
Error message
Failed to apply configuration to executable {renderedResource.ModelResource.Name} What it means
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.
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
Example fix
// before
var cs = builder.AddProject<Projects.Api>("api").GetEndpoint("https"); // endpoint that never exists
// after
var cs = builder.AddProject<Projects.Api>("api").WithEndpoint("https", e => e.Scheme = "https"); // ensure the endpoint is defined Defensive patterns
Strategy: try-catch
Try / catch
try
{
await creator.CreateObjectAsync(renderedResource, resourceLogger, ct);
}
catch (FailedToApplyEnvironmentException ex)
{
// Inspect ex.InnerException — the real configuration-resolution failure is there.
logger.LogError(ex.InnerException, "Config resolution failed for {Resource}.", resource.Name);
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Referencing an endpoint or connection string of a resource that failed to start; a custom IValueProvider/AddEnvironment callback throwing; missing referenced secret/parameter values.
Related errors
- Failed to apply launch configuration for resource
- ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set.
- ASPIRE_REMOTE_APPHOST_TOKEN environment variable is not set
- Failed to apply configuration to container
- Failed to create executable launch plan for resource
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/11fdd397a60b4dc9.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting/Dcp/ExecutableCreator.cs:63
!DcpModelUtilities.ShouldDeferCreateForExplicitStart(
resource.ModelResource,
resource.DcpResource.Spec.Start);
public async Task CreateObjectAsync(
RenderedModelResource<Executable> renderedResource,
EmptyCreationContext context,
ILogger resourceLogger,
IDcpObjectFactory factory,
CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
var configuration = await _configurationResolver
.ResolveAsync(renderedResource, resourceLogger, cancellationToken)
.ConfigureAwait(false);
if (configuration.Configuration.Exception is not null)
{
throw new FailedToApplyEnvironmentException(
$"Failed to apply configuration to executable {renderedResource.ModelResource.Name}",
configuration.Configuration.Exception);
}
ExecutableLaunchPlan plan;
try
{
plan = await ResolveLaunchPlanAsync(
renderedResource.ModelResource,
configuration.Configuration,
_configuration,
_distributedApplicationOptions,
_launchPolicy,
resourceLogger,
cancellationToken).ConfigureAwait(false);
}
catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested)
{View on GitHub (pinned to 25830f84bd)