microsoft/aspire · error · InvalidOperationException

Deno apps cannot be debugged through the Node dev-server…

Error message

Deno apps cannot be debugged through the Node dev-server debug path. '{resource.Name}' is a DenoAppResource; use AddDenoApp, which wires its own Deno debug support.

What it means

Like the Bun case, the Node dev-server debug path cannot attach to Deno. Deno apps get their own debug wiring via AddDenoApp; calling the Node-specific debug extension on a DenoAppResource is unsupported and throws with a pointer to the correct API.

Solutions

  1. Use AddDenoApp, which wires Deno's own debug support, and drop the Node debug extension call.
  2. In shared helpers, gate the Node debug extension on the resource not being DenoAppResource/BunAppResource.
  3. Configure Deno's inspector (--inspect) directly via args if custom debug settings are needed.

Example fix

// before
builder.AddDenoApp("app", "./app")
    .WithNodeDevServerDebugSupport();
// after
builder.AddDenoApp("app", "./app"); // AddDenoApp already wires Deno debug support
Defensive patterns

Strategy: type-guard

Validate before calling

if (resource is not DenoAppResource)
    builder.WithNodeDevServerDebugSupport();

Type guard

bool SupportsNodeDevServerDebug(IResource r) => r is not DenoAppResource and not BunAppResource;

Try / catch

try { builder.WithNodeDevServerDebugSupport(); }
catch (InvalidOperationException ex) when (ex.Message.Contains("DenoAppResource"))
{
    // Deno debug support is already wired by AddDenoApp; nothing to do
}

Prevention

When it happens

Trigger: Calling the Node dev-server debug extension on a builder whose resource is a DenoAppResource created via AddDenoApp.

Common situations: Generic debug setup helpers that treat all JavaScript runtimes alike; a project migrated from Node to Deno while keeping the Node debug extension call; examples copied between AppHosts with different runtimes.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/154800c168a6e661. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.JavaScript/JavaScriptHostingExtensions.cs:2877

    [Experimental("ASPIREEXTENSION001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
    internal static IResourceBuilder<T> WithVSCodeDebugging<T>(this IResourceBuilder<T> builder)
        where T : JavaScriptAppResource
    {
        ArgumentNullException.ThrowIfNull(builder);

        var resource = builder.Resource;
        var workingDirectory = Path.GetFullPath(resource.WorkingDirectory);

        if (resource is BunAppResource)
        {
            throw new InvalidOperationException(
                $"Bun apps cannot be debugged through the Node dev-server debug path. '{resource.Name}' is a {nameof(BunAppResource)}; use {nameof(AddBunApp)}, which wires its own Bun debug support.");
        }

        if (resource is DenoAppResource)
        {
            throw new InvalidOperationException(
                $"Deno apps cannot be debugged through the Node dev-server debug path. '{resource.Name}' is a {nameof(DenoAppResource)}; use {nameof(AddDenoApp)}, which wires its own Deno debug support.");
        }

        return builder.WithDebugSupport(
            mode =>
            {
                // Fall back to "npm" (the default for these frameworks) if no package manager annotation is present.
                var packageManager = "npm";
                if (resource.TryGetLastAnnotation<JavaScriptPackageManagerAnnotation>(out var pmAnnotation))
                {
                    packageManager = pmAnnotation.ExecutableName;
                }

                return new JavaScriptLaunchConfiguration("node")
                {
                    ScriptPath = string.Empty,
                    Mode = mode,
                    RuntimeExecutable = packageManager,

View on GitHub (pinned to 25830f84bd)