{"record":{"id":"f770131aa3807edf","repo":"go-delve/delve","slug":"s-must-be-followed-by-an-argument","errorCode":null,"errorMessage":"%s must be followed by an argument","messagePattern":"(.+?) must be followed by an argument","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/api/command.go","lineNumber":126,"sourceCode":"\t\t\tfilters = append(filters, ListGoroutinesFilter{Kind: GoroutineWaitingOnChannel, Arg: args[i]})\n\n\t\tcase \"-exec\":\n\t\t\tflags |= PrintGoroutinesExec\n\t\t\tcmd = strings.Join(args[i+1:], \" \")\n\t\t\ti = len(args)\n\n\t\tcase \"\":\n\t\t\t// nothing to do\n\t\tdefault:\n\t\t\treturn nil, GoroutineGroupingOptions{}, 0, 0, 0, 0, \"\", fmt.Errorf(\"wrong argument: '%s'\", arg)\n\t\t}\n\t}\n\treturn filters, group, fgl, flags, depth, batchSize, cmd, nil\n}\n\nfunc readGoroutinesFilterKind(args []string, i int) (GoroutineField, error) {\n\tif i >= len(args) {\n\t\treturn GoroutineFieldNone, fmt.Errorf(\"%s must be followed by an argument\", args[i-1])\n\t}\n\n\tswitch args[i] {\n\tcase \"curloc\":\n\t\treturn GoroutineCurrentLoc, nil\n\tcase \"userloc\":\n\t\treturn GoroutineUserLoc, nil\n\tcase \"goloc\":\n\t\treturn GoroutineGoLoc, nil\n\tcase \"startloc\":\n\t\treturn GoroutineStartLoc, nil\n\tcase \"label\":\n\t\treturn GoroutineLabel, nil\n\tcase \"running\":\n\t\treturn GoroutineRunning, nil\n\tcase \"user\":\n\t\treturn GoroutineUser, nil\n\tdefault:","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/api/command.go#L108-L144","documentation":"readGoroutinesFilterKind validates the value that must follow a goroutines filter flag (like -with or -without). If the flag is the last token in the argument list, the required value is missing and this error is thrown. args[i-1] is the flag that needed a value.","triggerScenarios":"Calling ParseGoroutineArgs or readGoroutinesFilter with a filter flag at the end of the argument list with no following value, e.g. 'goroutines -with label' or 'goroutines -without' (nothing after it).","commonSituations":"Quoting mistakes that swallow the value; forgetting the filter kind (curloc/userloc/label/function/running/user/file/line); shell splitting removing an empty quoted argument.","solutions":["Append the filter kind after the flag, e.g. 'goroutines -with label \"foo\"'.","Use a valid kind: curloc, userloc, label, function, running, user, file, line.","If you intended no filter, remove the dangling flag entirely."],"exampleFix":"// before\ncmd.ProcessLine(\"goroutines -with\")\n// after\ncmd.ProcessLine(\"goroutines -with label worker\")","handlingStrategy":"validation","validationCode":"func hasValueAfter(args []string, i int) bool { return i+1 < len(args) }\n// ensure every flag that needs a kind has a following token before calling ParseGoroutineArgs","typeGuard":null,"tryCatchPattern":"_, _, _, _, _, _, _, err := api.ParseGoroutineArgs(args)\nif err != nil {\n\tlog.Printf(\"filter flag missing value: %v\", err)\n}","preventionTips":["Never end an argument list with a bare filter flag","Check for dangling '-' tokens after shell splitting","Use quoting for values with spaces"],"tags":["cli","argument-parsing","delve"],"backgroundTag":"missing-required-argument","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}