{"record":{"id":"ac00a82b516acd1a","repo":"go-delve/delve","slug":"waiting-for-target-execve-failed-s","errorCode":null,"errorMessage":"waiting for target execve failed: %s","messagePattern":"waiting for target execve failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/native/proc_freebsd.go","lineNumber":128,"sourceCode":"\t\t\tdbp.ctty, err = attachProcessToTTY(process, tty)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif wd != \"\" {\n\t\t\tprocess.Dir = wd\n\t\t}\n\t\terr = process.Start()\n\t})\n\tclosefn()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdbp.pid = process.Process.Pid\n\tdbp.childProcess = true\n\t_, _, err = dbp.wait(process.Process.Pid, 0)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"waiting for target execve failed: %s\", err)\n\t}\n\ttgt, err := dbp.initialize(cmd[0], debugInfoDirs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn tgt, nil\n}\n\n// Attach to an existing process with the given PID. Once attached, if\n// the DWARF information cannot be found in the binary, Delve will look\n// for external debug files in the directories passed in.\nfunc Attach(pid int, waitFor *proc.WaitFor, debugInfoDirs []string) (*proc.TargetGroup, error) {\n\tif waitFor.Valid() {\n\t\tvar err error\n\t\tpid, err = WaitFor(waitFor)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/native/proc_freebsd.go#L110-L146","documentation":"On FreeBSD, Launch ptrace-follows the child through its execve and then blocks in dbp.wait for the exec stop event. If that wait returns an error, Delve reports \"waiting for target execve failed: <err>\" — the new program image never reported its initial stop, so symbol loading cannot proceed.","triggerScenarios":"proc.Launch on FreeBSD when the first wait(pid, 0) after starting the process fails: child died immediately (missing/broken binary, dynamic linker failure), or ptrace permission denied.","commonSituations":"Launching a binary whose shared libraries are missing (ELF interpreter errors); kern.ptrace security settings (e.g. kern.securelevel, procfs restrictions); launching through a shell wrapper on FreeBSD; binary built for a different ABI.","solutions":["Run the binary standalone first (`./cmd`) to surface exec/ldd errors.","Verify dynamic dependencies with `ldd ./cmd` and install missing libraries.","Check sysctl kern.ptrace / securelevel restrictions on the FreeBSD host.","Confirm the binary architecture matches the host (freebsd-amd64 vs arm64).","Retry the launch if the failure was a transient wait error (EINTR)."],"exampleFix":"// before\ndlv exec ./app   // fails: missing shared object\n// after\nldd ./app        # find missing libs\npkg install <missing-lib>\ndlv exec ./app","handlingStrategy":"validation","validationCode":"if err := exec.Command(binPath).Run(); err != nil {\n    return fmt.Errorf(\"target does not run standalone: %w\", err)\n}\n// also: ldd binPath to verify all shared objects resolve","typeGuard":null,"tryCatchPattern":"tgt, err := proc.Launch(cmd, wd, false, \"\", [], \"\", logger)\nif err != nil && strings.Contains(err.Error(), \"waiting for target execve failed\") {\n    // run the binary manually to see the exec/dynamic-linker error\n}","preventionTips":["Always run the target standalone before debugging it.","Verify dynamic dependencies with ldd on FreeBSD.","Match binary ABI/arch to the host.","Check kern.ptrace/securelevel restrictions on hardened hosts."],"tags":["freebsd","launch","execve","ptrace"],"backgroundTag":"execve-wait-failed","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}