{"record":{"id":"c33d22e1b7be0f70","repo":"go-delve/delve","slug":"waitfor-not-implemented","errorCode":null,"errorMessage":"waitfor not implemented","messagePattern":"waitfor not implemented","errorType":"exception","errorClass":"ErrWaitForNotImplemented","httpStatus":null,"severity":"error","filePath":"pkg/proc/target.go","lineNumber":746,"sourceCode":"// Checkpoint will always return an error on the native proc backend,\n// only supported for recorded traces.\nfunc (*dummyRecordingManipulation) Checkpoint(string) (int, error) { return -1, ErrNotRecorded }\n\n// Checkpoints will always return an error on the native proc backend,\n// only supported for recorded traces.\nfunc (*dummyRecordingManipulation) Checkpoints() ([]Checkpoint, error) { return nil, ErrNotRecorded }\n\n// ClearCheckpoint will always return an error on the native proc backend,\n// only supported in recorded traces.\nfunc (*dummyRecordingManipulation) ClearCheckpoint(int) error { return ErrNotRecorded }\n\n// Restart will always return an error in the native proc backend, only for\n// recorded traces.\nfunc (*dummyRecordingManipulation) Restart(*ContinueOnceContext, string) (Thread, error) {\n\treturn nil, ErrNotRecorded\n}\n\nvar ErrWaitForNotImplemented = errors.New(\"waitfor not implemented\")\n\nfunc (waitFor *WaitFor) Valid() bool {\n\treturn waitFor != nil && waitFor.Name != \"\"\n}\n","sourceCodeStart":728,"sourceCodeEnd":751,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/target.go#L728-L751","documentation":"ErrWaitForNotImplemented indicates that the backend in use does not support the WaitFor feature (attach once a process with a given name/pid pattern starts). It is returned by backends such as LLDBAttach and by the shared Attach path when waitFor is requested but cannot be honored. It exists so callers can distinguish 'feature missing' from 'process not found'.","triggerScenarios":"Calling debugger.Attach with a WaitFor struct (Valid() true, i.e. non-empty Name) against a backend that does not implement process polling, e.g. LLDBAttach, or the native Attach path reaching waitForSearchProcess on an unsupported platform.","commonSituations":"Using dlv attach --waitfor on a platform/backend combination that lacks the implementation; CI setups or IDE plugins passing waitFor unconditionally.","solutions":["Do not pass WaitFor to Attach for this backend; launch or attach by pid instead","Implement the wait externally (shell loop polling pgrep) then attach by pid","Check backend capability before setting WaitFor.Name","Use a backend (native on supported OS) that implements waitForSearchProcess"],"exampleFix":"// before\ndbg.Attach(pid, &proc.WaitFor{Name: \"myproc\"}, ...) // 'waitfor not implemented'\n// after\nif waitForBackendSupported {\n    dbg.Attach(0, &proc.WaitFor{Name: \"myproc\"}, ...)\n} else {\n    pid := pollPidByName(\"myproc\") // external polling\n    dbg.Attach(pid, nil, ...)\n}","handlingStrategy":"fallback","validationCode":"if waitFor != nil && waitFor.Name != \"\" && !backendSupportsWaitFor {\n    return fmt.Errorf(\"backend does not support waitFor\")\n}","typeGuard":null,"tryCatchPattern":"if _, err := dbg.Attach(pid, wf, os, false, []string{}); errors.Is(err, proc.ErrWaitForNotImplemented) {\n    pid = pollPidByName(name) // external wait, then plain attach\n}","preventionTips":["Don't pass WaitFor on backends known not to implement it","Poll for the process externally (pgrep loop) then attach by pid","Gate waitFor usage per platform/backend in your tooling"],"tags":["go","debugger","attach","waitfor"],"backgroundTag":"feature-not-implemented","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}