{"record":{"id":"6c3204d3e552999d","repo":"go-delve/delve","slug":"qthreadstopinfo-mismatch-requested-s-got-s","errorCode":null,"errorMessage":"qThreadStopInfo mismatch, requested %s got %s","messagePattern":"qThreadStopInfo mismatch, requested (.+?) got (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/gdbserial/gdbserver_conn.go","lineNumber":1165,"sourceCode":"\t}\n\tif sp.threadID != threadID {\n\t\t// When we send a ^C (manual stop request) and the process is close to\n\t\t// stopping anyway, sometimes, debugserver will send back two stop\n\t\t// packets. We need to ignore this spurious stop packet. Because the first\n\t\t// thing we do after the stop is updateThreadList, which calls this\n\t\t// function, this is relatively painless. We simply need to check that the\n\t\t// stop packet we receive is for the thread we requested, if it isn't we\n\t\t// can assume it is the spurious extra stop packet and simply ignore it.\n\t\t// An example of a problematic interaction is in the commit message for\n\t\t// this change.\n\t\t// See https://github.com/go-delve/delve/issues/3013.\n\n\t\tconn.conn.SetReadDeadline(time.Now().Add(10 * time.Millisecond))\n\t\tresp, err = conn.recv(conn.outbuf.Bytes(), \"thread stop info\", false)\n\t\tconn.conn.SetReadDeadline(time.Time{})\n\t\tif err != nil {\n\t\t\tif neterr, isneterr := err.(net.Error); isneterr && neterr.Timeout() {\n\t\t\t\treturn stopPacket{}, fmt.Errorf(\"qThreadStopInfo mismatch, requested %s got %s\", sp.threadID, threadID)\n\t\t\t}\n\t\t\treturn stopPacket{}, err\n\t\t}\n\t\t_, sp, err = conn.parseStopPacket(resp, \"\", nil)\n\t\tif err != nil {\n\t\t\treturn stopPacket{}, err\n\t\t}\n\t\tif sp.threadID != threadID {\n\t\t\treturn stopPacket{}, fmt.Errorf(\"qThreadStopInfo mismatch, requested %s got %s\", sp.threadID, threadID)\n\t\t}\n\t}\n\n\treturn sp, nil\n}\n\n// restart executes a 'vRun' command.\nfunc (conn *gdbConn) restart(pos string) error {\n\tconn.outbuf.Reset()","sourceCodeStart":1147,"sourceCodeEnd":1183,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/gdbserial/gdbserver_conn.go#L1147-L1183","documentation":"Thrown in the qThreadStopInfo handling when Delve waits (with a 10ms read deadline) for the stop packet for a specific thread and the read times out — no packet arrived in time, so Delve reports that the requested thread ID did not match what it got (nothing). This happens while racing to pick up which thread actually stopped after a continue.","triggerScenarios":"After a stop, Delve queries per-thread stop info for threadID; conn.recv times out at the 10ms deadline (net.Error Timeout), and the code converts the timeout into this mismatch error with an empty sp.threadID.","commonSituations":"Slow or loaded remote targets (network gdbserver, device debugging) where the stub takes longer than 10ms to answer; USB serial latency on iOS debugging; high system load delaying the reply.","solutions":["Retry the operation — it is a timing race and often succeeds on retry","Reduce target/system latency (wired connection instead of network/Wi-Fi, close background load)","Upgrade Delve; timeout handling in qThreadStopInfo has been adjusted in newer versions","If consistently reproducible, capture gdbwire logs and file an issue with the stub details"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"sp, err := conn.waitForSpecificStop(threadID)\nif err != nil && strings.Contains(err.Error(), \"qThreadStopInfo mismatch\") {\n    select {\n    case <-time.After(50 * time.Millisecond):\n        return conn.waitForSpecificStop(threadID) // bounded retry\n    }\n}","preventionTips":["Minimize latency to the target (wired links, local gdbserver)","Avoid overloading the host during remote debugging sessions","Upgrade Delve for improved timeout windows in qThreadStopInfo handling","Treat this error as transient: implement bounded retries in tooling"],"tags":["gdb-serial-protocol","go","timeout","thread-stop-info"],"backgroundTag":"qthreadstopinfo-mismatch","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}