microsoft/aspire · error · InvalidOperationException
Bun apps cannot be debugged through the Node dev-server…
Error message
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. What it means
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.
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.
Example fix
// before
builder.AddBunApp("app", "./app")
.WithNodeDevServerDebugSupport();
// after
builder.AddBunApp("app", "./app"); // AddBunApp already wires Bun debug support Defensive patterns
Strategy: type-guard
Validate before calling
if (resource is not BunAppResource)
builder.WithNodeDevServerDebugSupport(); Type guard
bool SupportsNodeDevServerDebug(IResource r) => r is not BunAppResource and not DenoAppResource;
Try / catch
try { builder.WithNodeDevServerDebugSupport(); }
catch (InvalidOperationException ex) when (ex.Message.Contains("BunAppResource"))
{
// Bun debug support is already wired by AddBunApp; nothing to do
} Prevention
- 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.
When it happens
Trigger: Calling the Node dev-server debug extension (e.g. .WithNodeDevServerDebugSupport(...)) on a builder whose resource is a BunAppResource created with AddBunApp.
Common situations: 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.
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
- Deno apps cannot be debugged through the Node dev-server…
- apiPath is required when apiTarget is specified.
- apiTarget is required when apiPath is specified.
- Cannot configure debugging: Python entrypoint annotation…
- DockerfileBuildAnnotation should exist after calling…
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/7b944410e549aaa0.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.JavaScript/JavaScriptHostingExtensions.cs:2871
private static string GetJavaScriptPackageManagerLaunchConfigurationType(string packageManagerExecutable) => packageManagerExecutable switch
{
"bun" => "bun",
"deno" => "deno",
_ => "node",
};
[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;
}View on GitHub (pinned to 25830f84bd)