{"record":{"id":"10464a08c4fd8dae","repo":"go-delve/delve","slug":"unknown-argument-q-to-target-follow-exec-10464a","errorCode":null,"errorMessage":"unknown argument %q to 'target follow-exec'","messagePattern":"unknown argument %q to 'target follow-exec'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/dap/command.go","lineNumber":304,"sourceCode":"\t\t\t\tregex = argv[1]\n\t\t\t}\n\t\t\tif err := s.debugger.FollowExec(true, regex); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tif regex != \"\" {\n\t\t\t\treturn fmt.Sprintf(\"Follow exec mode enabled with regex %q\", regex), nil\n\t\t\t}\n\t\t\treturn \"Follow exec mode enabled\", nil\n\t\tcase \"-off\":\n\t\t\tif len(argv) > 1 {\n\t\t\t\treturn \"\", errors.New(\"too many arguments\")\n\t\t\t}\n\t\t\tif err := s.debugger.FollowExec(false, \"\"); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\treturn \"Follow exec mode disabled\", nil\n\t\tdefault:\n\t\t\treturn \"\", fmt.Errorf(\"unknown argument %q to 'target follow-exec'\", argv[0])\n\t\t}\n\tcase \"switch\": // TODO: This may cause inconsistency between debugger and frontend.\n\t\ttgrp, unlock := s.debugger.LockTargetGroup()\n\t\tdefer unlock()\n\t\tpid, err := strconv.Atoi(argv[1])\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tfound := false\n\t\tfor _, tgt := range tgrp.Targets() {\n\t\t\tif _, err = tgt.Valid(); err == nil && tgt.Pid() == pid {\n\t\t\t\tfound = true\n\t\t\t\ttgrp.Selected = tgt\n\t\t\t\ttgt.SwitchThread(pid)\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\treturn \"\", fmt.Errorf(\"could not find target %d\", pid)","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/dap/command.go#L286-L322","documentation":"The DAP 'target follow-exec' REPL command only accepts -on [regex], -off, or no argument (status). Any other first argument after 'follow-exec' produces this error. It is strict argument validation for the follow-exec (child process following) subcommand.","triggerScenarios":"Evaluating 'target follow-exec enable', 'target follow-exec -on extra args misparsed', or any misspelled flag like '-enable'/'-true' via the DAP evaluate/REPL command path.","commonSituations":"Users habituated to other debuggers typing 'on'/'off' without the dash; IDE extension frontends constructing the command string with wrong flag names; typos such as '-onn' or '--on'.","solutions":["Use exactly 'target follow-exec -on [regex]' to enable or 'target follow-exec -off' to disable.","Call 'target follow-exec' with no argument to see the current status instead of guessing flags.","Check the command string your frontend builds for misspelled or undashed flags.","Note extra arguments to -off also fail; pass none."],"exampleFix":"// before\ntarget follow-exec enable\n// after\ntarget follow-exec -on\n// or with regex:\ntarget follow-exec -on ^/path/to/child$","handlingStrategy":"validation","validationCode":"validArgs := map[string]bool{\"-on\": true, \"-off\": true}\nif !validArgs[arg] {\n    return fmt.Errorf(\"use 'target follow-exec -on [regex]' or '-off', got %q\", arg)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use the documented flags -on and -off","Pass no extra arguments with -off","Run 'target follow-exec' bare to check current status"],"tags":["dap","command-args","follow-exec"],"backgroundTag":"unknown-command-argument","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}