microsoft/aspire · error · InvalidOperationException
Invalid value " " for "--dcp-dependency-check-timeout"…
Error message
Invalid value "{dcpPublisherConfiguration[nameof(options.DependencyCheckTimeout)]}" for "--dcp-dependency-check-timeout". Expected an integer value. What it means
DcpOptions.Configure parses the --dcp-dependency-check-timeout configuration value and requires it to be a valid integer. When the configured string exists but cannot be parsed by int.TryParse, it throws this InvalidOperationException instead of silently ignoring the value. This fails fast so a typo does not silently produce a default timeout.
Solutions
- Set --dcp-dependency-check-timeout to a plain integer of seconds, e.g. --dcp-dependency-check-timeout 90
- Remove the flag entirely to fall back to the DependencyCheckTimeout default or the KnownConfigNames.DependencyCheckTimeout value
- Check appsettings/environment config for the DcpPublisher:DependencyCheckTimeout key and fix it to an integer
Example fix
// before dotnet run --dcp-dependency-check-timeout 90s // after dotnet run --dcp-dependency-check-timeout 90
Defensive patterns
Strategy: validation
Validate before calling
var value = configuration["DcpPublisher:DependencyCheckTimeout"];
if (value is not null && !int.TryParse(value, out _))
{
throw new FormatException($"'{value}' is not a valid integer for --dcp-dependency-check-timeout.");
} Type guard
bool IsValidTimeoutValue(string? v) => v is null || int.TryParse(v, out _);
Try / catch
try
{
options.Configure(configuration);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("--dcp-dependency-check-timeout"))
{
// Fall back to default timeout or surface a corrected value.
options.DependencyCheckTimeout = 60;
} Prevention
- Always pass whole seconds as a plain integer, never "90s" or TimeSpan strings
- Validate config values in CI before launching the AppHost
- Prefer omitting the flag to use the built-in default
When it happens
Trigger: Setting --dcp-dependency-check-timeout (or DcpPublisher:DependencyCheckTimeout config key) to a non-integer string such as "30s", "00:00:30", "thirty", or a value with whitespace/units.
Common situations: Passing a TimeSpan-formatted value like "00:01:00" or "90s" on the command line or in appsettings.json expecting it to be parsed as a duration; copy-pasting values with trailing characters.
Understand the failure class
Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- CLI path must be provided
- Could not find DCP executable in the Aspire layout.
- Could not parse Helm version from 'helm version --short'…
- Developer Control Plane (DCP) exited before writing…
- Developer Control Plane (DCP) kubeconfig did not contain a…
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/3ba5605881c09ee2.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting/Dcp/DcpOptions.cs:324
if (!string.IsNullOrEmpty(dcpPublisherConfiguration[nameof(options.ContainerRuntime)]))
{
options.ContainerRuntime = dcpPublisherConfiguration[nameof(options.ContainerRuntime)];
}
else
{
options.ContainerRuntime = configuration.GetString(KnownConfigNames.ContainerRuntime, KnownConfigNames.Legacy.ContainerRuntime);
}
if (!string.IsNullOrEmpty(dcpPublisherConfiguration[nameof(options.DependencyCheckTimeout)]))
{
if (int.TryParse(dcpPublisherConfiguration[nameof(options.DependencyCheckTimeout)], out var timeout))
{
options.DependencyCheckTimeout = timeout;
}
else
{
throw new InvalidOperationException($"Invalid value \"{dcpPublisherConfiguration[nameof(options.DependencyCheckTimeout)]}\" for \"--dcp-dependency-check-timeout\". Expected an integer value.");
}
}
else
{
options.DependencyCheckTimeout = configuration.GetValue(KnownConfigNames.DependencyCheckTimeout, KnownConfigNames.Legacy.DependencyCheckTimeout, options.DependencyCheckTimeout);
}
options.KubernetesConfigReadRetryCount = dcpPublisherConfiguration.GetValue(nameof(options.KubernetesConfigReadRetryCount), options.KubernetesConfigReadRetryCount);
options.KubernetesConfigReadRetryIntervalMilliseconds = dcpPublisherConfiguration.GetValue(nameof(options.KubernetesConfigReadRetryIntervalMilliseconds), options.KubernetesConfigReadRetryIntervalMilliseconds);
if (!string.IsNullOrEmpty(dcpPublisherConfiguration[nameof(options.ResourceNameSuffix)]))
{
options.ResourceNameSuffix = dcpPublisherConfiguration[nameof(options.ResourceNameSuffix)];
}
options.RandomizePorts = dcpPublisherConfiguration.GetValue(nameof(options.RandomizePorts), options.RandomizePorts);
options.ProxylessEndpointPortRangeStart = dcpPublisherConfiguration.GetValue(nameof(options.ProxylessEndpointPortRangeStart), options.ProxylessEndpointPortRangeStart);
options.ProxylessEndpointPortRangeEnd = dcpPublisherConfiguration.GetValue(nameof(options.ProxylessEndpointPortRangeEnd), options.ProxylessEndpointPortRangeEnd);View on GitHub (pinned to 25830f84bd)