{"record":{"id":"729358df189e750e","repo":"go-delve/delve","slug":"could-not-attach-to-pid-d-s","errorCode":null,"errorMessage":"could not attach to pid %d: %s","messagePattern":"could not attach to pid (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/debugger/debugger.go","lineNumber":2570,"sourceCode":"\tcase \"linux\", \"freebsd\":\n\t\texe, err = elf.NewFile(f)\n\tcase \"windows\":\n\t\texe, err = pe.NewFile(f)\n\tdefault:\n\t\tpanic(\"attempting to open file Delve cannot parse\")\n\t}\n\n\tif err != nil {\n\t\treturn \"\", api.ErrNotExecutable\n\t}\n\texe.Close()\n\treturn fullpath, nil\n}\n\nvar attachErrorMessage = attachErrorMessageDefault\n\nfunc attachErrorMessageDefault(pid int, err error) error {\n\treturn fmt.Errorf(\"could not attach to pid %d: %s\", pid, err)\n}\n\nfunc (d *Debugger) maybePrintUnattendedStopWarning(stopReason proc.StopReason, currentThread *api.Thread, clientStatusCh <-chan struct{}) {\n\tselect {\n\tcase <-clientStatusCh:\n\t\t// the channel will be closed if the client that sends the command has left\n\t\t// i.e. closed the connection.\n\tdefault:\n\t\treturn\n\t}\n\n\tif currentThread == nil || currentThread.Breakpoint == nil {\n\t\tswitch stopReason {\n\t\tcase proc.StopManual:\n\t\t\t// print nothing\n\t\t\treturn\n\t\tdefault:\n\t\t\tfmt.Fprintln(os.Stderr, \"Stop reason: \"+stopReason.String())","sourceCodeStart":2552,"sourceCodeEnd":2588,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/debugger/debugger.go#L2552-L2588","documentation":"Error \"could not attach to pid %d: %s\" thrown in go-delve/delve.","triggerScenarios":"Thrown at service/debugger/debugger.go:2570 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}