{"record":{"id":"7b944410e549aaa0","repo":"microsoft/aspire","slug":"bun-apps-cannot-be-debugged-through-the-node-dev-server","errorCode":null,"errorMessage":"Bun apps cannot be debugged through the Node dev-server debug path. '{resource.Name}' is a BunAppResource; use AddBunApp, which wires its own Bun debug support.","messagePattern":"Bun apps cannot be debugged through the Node dev-server debug path\\. '(.+?)' is a BunAppResource; use AddBunApp, which wires its own Bun debug support\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.JavaScript/JavaScriptHostingExtensions.cs","lineNumber":2871,"sourceCode":"    private static string GetJavaScriptPackageManagerLaunchConfigurationType(string packageManagerExecutable) => packageManagerExecutable switch\n    {\n        \"bun\" => \"bun\",\n        \"deno\" => \"deno\",\n        _ => \"node\",\n    };\n\n    [Experimental(\"ASPIREEXTENSION001\", UrlFormat = \"https://aka.ms/aspire/diagnostics/{0}\")]\n    internal static IResourceBuilder<T> WithVSCodeDebugging<T>(this IResourceBuilder<T> builder)\n        where T : JavaScriptAppResource\n    {\n        ArgumentNullException.ThrowIfNull(builder);\n\n        var resource = builder.Resource;\n        var workingDirectory = Path.GetFullPath(resource.WorkingDirectory);\n\n        if (resource is BunAppResource)\n        {\n            throw new InvalidOperationException(\n                $\"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.\");\n        }\n\n        if (resource is DenoAppResource)\n        {\n            throw new InvalidOperationException(\n                $\"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.\");\n        }\n\n        return builder.WithDebugSupport(\n            mode =>\n            {\n                // Fall back to \"npm\" (the default for these frameworks) if no package manager annotation is present.\n                var packageManager = \"npm\";\n                if (resource.TryGetLastAnnotation<JavaScriptPackageManagerAnnotation>(out var pmAnnotation))\n                {\n                    packageManager = pmAnnotation.ExecutableName;\n                }","sourceCodeStart":2853,"sourceCodeEnd":2889,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.JavaScript/JavaScriptHostingExtensions.cs#L2853-L2889","documentation":"The Node dev-server debug support extension only wires Node.js debug tooling. Bun has its own debugger wiring added via AddBunApp, so calling the Node debug path on a BunAppResource would attach an incompatible debugger. Aspire throws with guidance to use the Bun-specific API.","triggerScenarios":"Calling the Node dev-server debug extension (e.g. .WithNodeDevServerDebugSupport(...)) on a builder whose resource is a BunAppResource created with AddBunApp.","commonSituations":"Shared helper code applying uniform debug configuration to all JavaScript resources regardless of runtime; copy-pasted AppHost code where the resource changed from Node to Bun; generic loops attaching Node debug support to every resource.","solutions":["Use AddBunApp for Bun workloads — it wires Bun's own debug support; do not call the Node debug extension.","In shared helpers, only call the Node debug extension when the resource is not BunAppResource/DenoAppResource.","Configure Bun's native inspector separately if a custom debug setup is needed."],"exampleFix":"// before\nbuilder.AddBunApp(\"app\", \"./app\")\n    .WithNodeDevServerDebugSupport();\n// after\nbuilder.AddBunApp(\"app\", \"./app\"); // AddBunApp already wires Bun debug support","handlingStrategy":"type-guard","validationCode":"if (resource is not BunAppResource)\n    builder.WithNodeDevServerDebugSupport();","typeGuard":"bool SupportsNodeDevServerDebug(IResource r) => r is not BunAppResource and not DenoAppResource;","tryCatchPattern":"try { builder.WithNodeDevServerDebugSupport(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"BunAppResource\"))\n{\n    // Bun debug support is already wired by AddBunApp; nothing to do\n}","preventionTips":["In shared debug-setup helpers, branch on runtime type (Node vs Bun vs Deno).","Never apply Node-specific extensions to BunAppResource builders.","Let AddBunApp own Bun debug wiring."],"tags":["aspire","javascript","bun","debugging","unsupported-operation"],"backgroundTag":"unsupported-operation","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"}