{"record":{"id":"51888c267888f4c9","repo":"oven-sh/bun","slug":"not-supported-type","errorCode":null,"errorMessage":"Not supported: ${type}","messagePattern":"Not supported: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bun-vscode/src/features/debug.ts","lineNumber":439,"sourceCode":"    const { type } = message;\n\n    if (type === \"request\") {\n      const { untitledDocPath, bunEvalPath } = this;\n      const { command } = message;\n      if (command === \"setBreakpoints\" || command === \"breakpointLocations\") {\n        const args = message.arguments as any;\n        if (untitledDocPath && args.source?.path === untitledDocPath) {\n          args.source.path = bunEvalPath;\n        } else if (args.source?.path) {\n          args.source.path = this.mapLocalToRemote(args.source.path);\n        }\n      } else if (command === \"source\" && message.arguments?.source?.path) {\n        message.arguments.source.path = this.mapLocalToRemote(message.arguments.source.path);\n      }\n\n      this.adapter.emit(\"Adapter.request\", message);\n    } else {\n      throw new Error(`Not supported: ${type}`);\n    }\n  }\n\n  dispose() {\n    this.adapter.close();\n  }\n}\n\nclass TerminalDebugSession extends FileDebugSession {\n  signal!: TCPSocketSignal | UnixSignal;\n\n  constructor() {\n    super(undefined, undefined);\n  }\n\n  async initialize() {\n    await super.initialize();\n    if (process.platform === \"win32\") {","sourceCodeStart":421,"sourceCodeEnd":457,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/packages/bun-vscode/src/features/debug.ts#L421-L457","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nsession.handleMessage(message); // may be a response/event -> throws\n\n// after\nif (message.type === 'request') session.handleMessage(message);","handlingStrategy":"validation","validationCode":"function isDapRequest(m: { type: string }): boolean {\n  return m.type === 'request';\n}\nif (!isDapRequest(message)) return; // never forward responses/events into handleMessage","typeGuard":"const isDapRequest = (m: { type: string }): m is DAP.Request => m.type === 'request';","tryCatchPattern":null,"preventionTips":["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"],"tags":["vscode","dap","debugger","protocol"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}