{"record":{"id":"e9afcea5c07b6a0f","repo":"go-delve/delve","slug":"too-many-arguments-e9afce","errorCode":null,"errorMessage":"too many arguments","messagePattern":"too many arguments","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/terminal/command.go","lineNumber":3572,"sourceCode":"\t\tif len(argv) == 1 {\n\t\t\tif t.client.FollowExecEnabled() {\n\t\t\t\tfmt.Fprintf(t.stdout, \"Follow exec is enabled.\\n\")\n\t\t\t} else {\n\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 {","sourceCodeStart":3554,"sourceCodeEnd":3590,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/terminal/command.go#L3554-L3590","documentation":"The 'target follow-exec -off' variant takes no further arguments. The '-off' case turns off exec following via FollowExec(false, \"\"), and if extra tokens were supplied after '-off' the command rejects them as 'too many arguments'.","triggerScenarios":"Running 'target follow-exec -off <anything>', e.g. 'target follow-exec -off regex' or a stray extra token.","commonSituations":"Users assuming -off takes the same optional regex that the enable variant accepts (len(argv)==2 there), or leftover text in the command line.","solutions":["Use 'target follow-exec -off' with no additional arguments.","If you meant to set a regex filter, use the enable form: 'target follow-exec -on <regex>' (or without -on) instead.","Trim accidental extra tokens from the command."],"exampleFix":"// before\ntarget follow-exec -off myregex\n// after\ntarget follow-exec -off","handlingStrategy":"validation","validationCode":"if len(strings.Fields(cmd)) > 3 { return errors.New(\"target follow-exec -off takes no arguments\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use 'target follow-exec -off' with no extra tokens.","Use the enable form ('target follow-exec [regex]') when a regex filter is needed.","Double-check for stray arguments in scripted commands."],"tags":["cli","argument-validation","delve"],"backgroundTag":"too-many-arguments","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}