{"record":{"id":"d6d3c7a84b343a52","repo":"go-delve/delve","slug":"unknown-debug-event-code-d","errorCode":null,"errorMessage":"unknown debug event code: %d","messagePattern":"unknown debug event code: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/native/proc_windows.go","lineNumber":508,"sourceCode":"\t\t\t\t// This exception is sent to set the thread name in VisualC, we should\n\t\t\t\t// mask it or it might crash the program.\n\t\t\t\tcontinueStatus = _DBG_CONTINUE\n\t\t\tdefault:\n\t\t\t\tcontinueStatus = _DBG_EXCEPTION_NOT_HANDLED\n\t\t\t}\n\t\tcase _EXIT_PROCESS_DEBUG_EVENT:\n\t\t\tdebugInfo := (*_EXIT_PROCESS_DEBUG_INFO)(unionPtr)\n\t\t\tdbp := procgrp.procForPid(int(debugEvent.ProcessId))\n\t\t\tdbp.postExit()\n\t\t\tif procgrp.numValid() == 0 {\n\t\t\t\terr = _ContinueDebugEvent(debugEvent.ProcessId, debugEvent.ThreadId, continueStatus)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn 0, err\n\t\t\t\t}\n\t\t\t\treturn 0, proc.ErrProcessExited{Pid: dbp.pid, Status: int(debugInfo.ExitCode)}\n\t\t\t}\n\t\tdefault:\n\t\t\treturn 0, fmt.Errorf(\"unknown debug event code: %d\", debugEvent.DebugEventCode)\n\t\t}\n\n\t\t// .. and then continue unless we received an event that indicated we should break into debugger.\n\t\terr = _ContinueDebugEvent(debugEvent.ProcessId, debugEvent.ThreadId, continueStatus)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n}\n\nfunc trapWait(procgrp *processGroup, pid int) (*nativeThread, error) {\n\tvar err error\n\tvar tid int\n\tprocgrp.procs[0].execPtraceFunc(func() {\n\t\ttid, err = procgrp.waitForDebugEvent(waitBlocking)\n\t})\n\tif err != nil {\n\t\treturn nil, err","sourceCodeStart":490,"sourceCodeEnd":526,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/native/proc_windows.go#L490-L526","documentation":"In the Windows native backend's debug event loop, waitForDebugEvent receives DEBUG_EVENT structures with a DebugEventCode. The switch handles the known codes (create/load/exit events); if the OS delivers a code the backend does not recognize, it returns this error instead of continuing. This usually means the backend needs updating for an event type it doesn't yet handle, or that event code state was corrupted.","triggerScenarios":"Calling continue/step operations on Windows when WaitForDebugEvent returns a DebugEventCode outside the handled set (exception, create process/thread, exit process/thread, DLL load/unload, rip event, etc.).","commonSituations":"Attaching to processes that generate unusual debug events (e.g. adjunct/ETW-triggered events on unusual Windows builds); custom or preview Windows versions producing new event codes; extremely rare corruption.","solutions":["Record the DebugEventCode value from the error message and report it to the Delve project with the Windows version.","Update Delve to the latest version — new Windows event codes are sometimes added.","Check the Windows SDK documentation for the code (bit 31-30 severity, 29 customer bit) to identify the event type.","As a workaround, retry the operation; a single unrecognized event may not be fatal to the debug session."],"exampleFix":"// before\ndlv exec app.exe\n// unknown debug event code: 2147549185\n// after\n# upgrade delve to pick up new event-code handling\ngo install github.com/go-delve/delve/cmd/dlv@latest\ndlv exec app.exe","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"_, err := dbg.Command(&api.DebuggerCommand{Name: \"continue\"})\nif err != nil {\n    var unk *fmt.Errorf // match by message\n    if strings.Contains(err.Error(), \"unknown debug event code\") {\n        // extract the code, check Windows SDK docs, upgrade delve, report issue\n    }\n}","preventionTips":["Keep Delve up to date for new Windows event-code handling.","Record the unknown code from the message before restarting.","Test debug sessions on the exact Windows build you deploy to."],"tags":["windows","debug-events","ptrace","backend"],"backgroundTag":"unknown-debug-event-code","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}