go-delve/delve · error · ErrWaitForNotImplemented

waitfor not implemented

Error message

waitfor not implemented

What it means

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'.

Source

Thrown at pkg/proc/target.go:746

// Checkpoint will always return an error on the native proc backend,
// only supported for recorded traces.
func (*dummyRecordingManipulation) Checkpoint(string) (int, error) { return -1, ErrNotRecorded }

// Checkpoints will always return an error on the native proc backend,
// only supported for recorded traces.
func (*dummyRecordingManipulation) Checkpoints() ([]Checkpoint, error) { return nil, ErrNotRecorded }

// ClearCheckpoint will always return an error on the native proc backend,
// only supported in recorded traces.
func (*dummyRecordingManipulation) ClearCheckpoint(int) error { return ErrNotRecorded }

// Restart will always return an error in the native proc backend, only for
// recorded traces.
func (*dummyRecordingManipulation) Restart(*ContinueOnceContext, string) (Thread, error) {
	return nil, ErrNotRecorded
}

var ErrWaitForNotImplemented = errors.New("waitfor not implemented")

func (waitFor *WaitFor) Valid() bool {
	return waitFor != nil && waitFor.Name != ""
}

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Do not pass WaitFor to Attach for this backend; launch or attach by pid instead
  2. Implement the wait externally (shell loop polling pgrep) then attach by pid
  3. Check backend capability before setting WaitFor.Name
  4. Use a backend (native on supported OS) that implements waitForSearchProcess

Example fix

// before
dbg.Attach(pid, &proc.WaitFor{Name: "myproc"}, ...) // 'waitfor not implemented'
// after
if waitForBackendSupported {
    dbg.Attach(0, &proc.WaitFor{Name: "myproc"}, ...)
} else {
    pid := pollPidByName("myproc") // external polling
    dbg.Attach(pid, nil, ...)
}
Defensive patterns

Strategy: fallback

Validate before calling

if waitFor != nil && waitFor.Name != "" && !backendSupportsWaitFor {
    return fmt.Errorf("backend does not support waitFor")
}

Try / catch

if _, err := dbg.Attach(pid, wf, os, false, []string{}); errors.Is(err, proc.ErrWaitForNotImplemented) {
    pid = pollPidByName(name) // external wait, then plain attach
}

Prevention

When it happens

Trigger: 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.

Common situations: Using dlv attach --waitfor on a platform/backend combination that lacks the implementation; CI setups or IDE plugins passing waitFor unconditionally.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/c33d22e1b7be0f70. Report an issue: GitHub.