{"record":{"id":"44f37e2977242697","repo":"go-delve/delve","slug":"wrong-argument-s","errorCode":null,"errorMessage":"wrong argument: '%s'","messagePattern":"wrong argument: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/api/command.go","lineNumber":75,"sourceCode":"\t\tcase \"-s\":\n\t\t\tfgl = FglStart\n\t\tcase \"-l\":\n\t\t\tflags |= PrintGoroutinesLabels\n\t\tcase \"-t\":\n\t\t\tflags |= PrintGoroutinesStack\n\t\t\t// optional depth argument\n\t\t\tif i+1 < len(args) && len(args[i+1]) > 0 {\n\t\t\t\tn, err := strconv.Atoi(args[i+1])\n\t\t\t\tif err == nil {\n\t\t\t\t\tdepth = n\n\t\t\t\t\ti++\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase \"-w\", \"-with\":\n\t\t\tfilter, err := readGoroutinesFilter(args, &i)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, GoroutineGroupingOptions{}, 0, 0, 0, 0, \"\", fmt.Errorf(\"wrong argument: '%s'\", arg)\n\t\t\t}\n\t\t\tfilters = append(filters, *filter)\n\n\t\tcase \"-wo\", \"-without\":\n\t\t\tfilter, err := readGoroutinesFilter(args, &i)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, GoroutineGroupingOptions{}, 0, 0, 0, 0, \"\", fmt.Errorf(\"wrong argument: '%s'\", arg)\n\t\t\t}\n\t\t\tfilter.Negated = true\n\t\t\tfilters = append(filters, *filter)\n\n\t\tcase \"-group\":\n\t\t\tvar err error\n\t\t\tgroup.GroupBy, err = readGoroutinesFilterKind(args, i+1)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, GoroutineGroupingOptions{}, 0, 0, 0, 0, \"\", fmt.Errorf(\"wrong argument: '%s'\", arg)\n\t\t\t}\n\t\t\ti++","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/api/command.go#L57-L93","documentation":"`ParseGoroutineArgs` parses the argument string of the `goroutines` command. For the `-w`/`-with` filter flag, the following tokens are parsed by `readGoroutinesFilter`; if that fails (missing or malformed filter, e.g. no kind=value pair), the parser returns `wrong argument: '<arg>'` naming the flag. The error is a parse failure of the goroutines command-line syntax, not an RPC error.","triggerScenarios":"Passing `-w` or `-with` without a following filter argument, or with a filter that readGoroutinesFilter cannot parse (malformed kind:value, unparseable number, unknown filter kind).","commonSituations":"Typing `goroutines -w` and forgetting the filter; using a filter kind not in the supported list; quoting problems splitting the arg string on spaces.","solutions":["Supply a valid filter after -w, e.g. `goroutines -w running` or `-w userloc=main.main`","Check the supported filter kinds (running, userloc, startloc, label, etc.) in the goroutines command help","Quote arguments containing spaces correctly so the split-on-space parser sees the right tokens"],"exampleFix":"// before\ngoroutines -w\n// after\ngoroutines -w running","handlingStrategy":"validation","validationCode":"// before invoking: ensure -w/-with is followed by a parsable filter\ntokens := strings.Fields(argstr)\nfor i, t := range tokens {\n    if t == \"-w\" || t == \"-with\" {\n        if i+1 >= len(tokens) || !strings.Contains(tokens[i+1], \"=\") && !isFilterKind(tokens[i+1]) {\n            return fmt.Errorf(\"-w requires a filter operand\")\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    var perr interface{ Error() string }\n    if errors.As(err, &perr) && strings.HasPrefix(err.Error(), \"wrong argument:\") {\n        // surface usage help for the goroutines command\n    }\n}","preventionTips":["Always provide a filter operand after -w/-with","Use filter kinds listed in the goroutines command help","Quote tokens with spaces so the space-splitting parser sees intact operands"],"tags":["cli","goroutines","argument-parsing"],"backgroundTag":"invalid-command-argument","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}