{"record":{"id":"4c16ca4a06b4271b","repo":"go-delve/delve","slug":"unknown-argument-q-to-target-follow-exec","errorCode":null,"errorMessage":"unknown argument %q to 'target follow-exec'","messagePattern":"unknown argument %q to 'target follow-exec'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/terminal/command.go","lineNumber":3576,"sourceCode":"\t\t\t\tfmt.Fprintf(t.stdout, \"Follow exec is disabled.\\n\")\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\targv = config.Split2PartsBySpace(argv[1])\n\t\tswitch argv[0] {\n\t\tcase \"-on\":\n\t\t\tvar regex string\n\t\t\tif len(argv) == 2 {\n\t\t\t\tregex = argv[1]\n\t\t\t}\n\t\t\tt.client.FollowExec(true, regex)\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\tt.client.FollowExec(false, \"\")\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unknown argument %q to 'target follow-exec'\", argv[0])\n\t\t}\n\t\treturn nil\n\tcase \"switch\":\n\t\ttgts, err := t.client.ListTargets()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\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 tgts {\n\t\t\tif tgt.Pid == pid {\n\t\t\t\tfound = true\n\t\t\t\tt.client.SwitchThread(tgt.CurrentThread.ID)\n\t\t\t}\n\t\t}","sourceCodeStart":3558,"sourceCodeEnd":3594,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/terminal/command.go#L3558-L3594","documentation":"`target follow-exec` accepts at most one flag: `-on` (implicit/default), `-off`, or `-regex <pattern>`. Any other token is rejected with this message by the default case.","triggerScenarios":"Running e.g. `target follow-exec -all`, `target follow-exec foo`, or any misspelled flag.","commonSituations":"Typos (`-of` instead of `-off`); trying to pass an exec pattern directly without the `-regex` flag; muscle memory from other debuggers.","solutions":["Use `target follow-exec -regex <pattern>` to filter exec'd children by pattern","Use `target follow-exec -off` to disable","Use `target follow-exec -on` (or bare) to enable for all children","Check flag spelling and case"],"exampleFix":"// before\ntarget follow-exec server*\n// after\ntarget follow-exec -regex server*","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if !validFollowExecArg(argv[0]) {\n    return fmt.Errorf(\"%q invalid; use -on, -off, or -regex <pattern>\", argv[0])\n}","preventionTips":["Validate subcommand flags against a whitelist"],"tags":["terminal","follow-exec","cli"],"backgroundTag":"invalid-command-option","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}