microsoft/aspire · error · InvalidOperationException
The argument ' ' cannot be configured with…
Error message
The argument '{arg}' cannot be configured with WithDenoRuntimeArgs because {conflict.Source} already emits {conflict.ManagedFlag}, and Deno rejects those arguments when they are combined. {conflict.Remedy} What it means
BuildDenoArgs detects when a user-supplied runtime argument (e.g. '--inspect', '--unstable-*') duplicates a flag that Aspire already emits because of annotations (WithDenoInspect, WithDenoUnstable, serve endpoints, import maps, dev flags). Deno rejects such duplicate/combined flags, so the library throws InvalidOperationException naming the conflicting flag, its source, and the remedy.
Solutions
- Remove the duplicated argument from WithDenoRuntimeArgs and configure it via its dedicated API (WithDenoInspect, WithDenoUnstable, WithDenoServeEndpoint, etc.).
- Follow the conflict.Remedy text in the message, which states exactly which feature already emits the flag.
- Audit all WithDenoRuntimeArgs call sites for strings starting with '--inspect' or '--unstable-' and route them to the proper builder method.
- Only keep genuinely free-form arguments (e.g. script positional args) in WithDenoRuntimeArgs.
Example fix
// before
resource.WithDenoInspect().WithDenoRuntimeArgs("--inspect-brk");
// after
resource.WithDenoInspect(DenoInspectMode.InspectBrk); Defensive patterns
Strategy: validation
Validate before calling
foreach (var a in runtimeArgs) if (a.StartsWith("--inspect") || a.StartsWith("--unstable-")) throw new ArgumentException($"'{a}' is managed by a dedicated WithDeno* API; remove it from runtime args."); Try / catch
try { app.Run(); } catch (InvalidOperationException ex) when (ex.Message.Contains(nameof(WithDenoRuntimeArgs))) { /* drop the conflicting runtime arg and reconfigure */ } Prevention
- Configure inspector/unstable/serve/import-map features only through their dedicated WithDeno* methods
- Reserve WithDenoRuntimeArgs for flags Aspire does not manage
- Search the codebase for hardcoded '--inspect'/'--unstable-' strings during migration
When it happens
Trigger: Calling WithDenoRuntimeArgs("--inspect", ...) while WithDenoInspect is also configured; passing '--unstable-kv' via runtime args while WithDenoUnstable already adds it; enabling dev flags/import maps/serve endpoints that emit a flag the user also passes manually.
Common situations: Migrating an existing Deno launch script into Aspire and keeping all CLI flags as runtime args; enabling the inspector for debugging while another config source also sets it; incremental Aspire adoption where flags were added twice via different APIs.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- PublishAsPackageScript requires a Deno package manager. Add…
- The value ' ' cannot contain a comma. Deno separates values…
- Unsupported Deno node_modules mode
- Deno apps cannot be debugged through the Node dev-server…
- Deno command-line options configured with the WithDeno*…
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/333ff53490b4eceb.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.JavaScript/DenoHostingExtensions.cs:749
bool includeImportMap,
bool includeDevelopmentFlags)
{
foreach (var arg in deno.RuntimeArgs)
{
// Both spellings reach Deno's parser: "--port 3000" (separate value) and "--port=3000".
var name = arg.AsSpan();
var separator = name.IndexOf('=');
if (separator >= 0)
{
name = name[..separator];
}
if (GetManagedDenoFlagConflict(name, deno, emitsServeEndpoint, includeImportMap, includeDevelopmentFlags) is not { } conflict)
{
continue;
}
throw new InvalidOperationException(
$"The argument '{arg}' cannot be configured with {nameof(WithDenoRuntimeArgs)} because {conflict.Source} already emits {conflict.ManagedFlag}, and Deno rejects those arguments when they are combined. {conflict.Remedy}");
}
}
private static (string ManagedFlag, string Source, string Remedy)? GetManagedDenoFlagConflict(
ReadOnlySpan<char> name,
DenoCommandLineAnnotation deno,
bool emitsServeEndpoint,
bool includeImportMap,
bool includeDevelopmentFlags)
{
if (emitsServeEndpoint && (name.Equals("--host", StringComparison.Ordinal) || name.Equals("--port", StringComparison.Ordinal)))
{
return ("--host and --port from the resource's endpoint", nameof(WithDenoServe), "Configure the endpoint instead, for example WithHttpEndpoint(port: 5005).");
}
// -c is an alias for --config, while --no-config is mutually exclusive with it.
if (!string.IsNullOrEmpty(deno.ConfigFile) &&View on GitHub (pinned to 25830f84bd)