oven-sh/bun · error · Error
Not supported: ${type}
Error message
Not supported: ${type} What it means
handleMessage() on the VS Code debug session is the inbound path for editor-to-adapter traffic and only accepts DAP messages with type 'request' (it rewrites source paths and forwards to the adapter). Any other message type — a 'response' or 'event' sent toward the session — violates the protocol direction and throws immediately.
Source
Thrown at packages/bun-vscode/src/features/debug.ts:439
const { type } = message;
if (type === "request") {
const { untitledDocPath, bunEvalPath } = this;
const { command } = message;
if (command === "setBreakpoints" || command === "breakpointLocations") {
const args = message.arguments as any;
if (untitledDocPath && args.source?.path === untitledDocPath) {
args.source.path = bunEvalPath;
} else if (args.source?.path) {
args.source.path = this.mapLocalToRemote(args.source.path);
}
} else if (command === "source" && message.arguments?.source?.path) {
message.arguments.source.path = this.mapLocalToRemote(message.arguments.source.path);
}
this.adapter.emit("Adapter.request", message);
} else {
throw new Error(`Not supported: ${type}`);
}
}
dispose() {
this.adapter.close();
}
}
class TerminalDebugSession extends FileDebugSession {
signal!: TCPSocketSignal | UnixSignal;
constructor() {
super(undefined, undefined);
}
async initialize() {
await super.initialize();
if (process.platform === "win32") {View on GitHub (pinned to 8c5296ac45)
Solutions
- Filter by message type before dispatching: only forward type === 'request' to handleMessage
- Route responses and events through the adapters' 'Adapter.response'/'Adapter.event' listeners instead
- If you are replaying traffic, split the transcript by direction first
Example fix
// before session.handleMessage(message); // may be a response/event -> throws // after if (message.type === 'request') session.handleMessage(message);
Defensive patterns
Strategy: validation
Validate before calling
function isDapRequest(m: { type: string }): boolean {
return m.type === 'request';
}
if (!isDapRequest(message)) return; // never forward responses/events into handleMessage Type guard
const isDapRequest = (m: { type: string }): m is DAP.Request => m.type === 'request'; Prevention
- Dispatch inbound editor traffic by message type before touching the session
- In tests, split recorded DAP transcripts into requests vs responses/events by direction
- Never loop adapter-side output back into the client-side session handler
When it happens
Trigger: A custom extension, test harness, or DAP proxy calling session.sendMessage/sendRequest with a Response or Event object (e.g. replaying recorded adapter traffic back into the session); wiring both ends of a DebugSession to the same emitter.
Common situations: Writing VS Code extension tests that feed captured DAP transcripts into the session; proxies that accidentally loop adapter responses back to the client-side session; custom UIs multiplexing both directions through one handler.
Related errors
AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16).
Data as JSON: /api/errors/51888c267888f4c9.
Report an issue: GitHub.