{"record":{"id":"0bf8d866f3b89b4f","repo":"go-delve/delve","slug":"s-s-needs-to-be-followed-by-an-expression","errorCode":null,"errorMessage":"%s %s needs to be followed by an expression","messagePattern":"(.+?) (.+?) needs to be followed by an expression","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/api/command.go","lineNumber":162,"sourceCode":"\tdefault:\n\t\treturn GoroutineFieldNone, fmt.Errorf(\"unrecognized argument to %s %s\", args[i-1], args[i])\n\t}\n}\n\nfunc readGoroutinesFilter(args []string, pi *int) (*ListGoroutinesFilter, error) {\n\tr := new(ListGoroutinesFilter)\n\tvar err error\n\tr.Kind, err = readGoroutinesFilterKind(args, *pi+1)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t*pi++\n\tswitch r.Kind {\n\tcase GoroutineRunning, GoroutineUser:\n\t\treturn r, nil\n\t}\n\tif *pi+1 >= len(args) {\n\t\treturn nil, fmt.Errorf(\"%s %s needs to be followed by an expression\", args[*pi-1], args[*pi])\n\t}\n\tr.Arg = args[*pi+1]\n\t*pi++\n\n\treturn r, nil\n}\n\ntype ExamineMemoryArgs struct {\n\tOperand string\n\tCount   int64\n\tSize    int64\n\tIsExpr  bool\n\tFormat  byte\n\tRawOut  bool\n}\n\nfunc ParseExamineMemoryArg(argstr string) (*ExamineMemoryArgs, error) {\n\t// default args","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/api/command.go#L144-L180","documentation":"readGoroutinesFilter accepts filters that require an argument (curloc, userloc, label, function, file, line). If such a filter kind is followed by no expression, this error is thrown naming both tokens. Filters like 'running' and 'user' are exempt and return early.","triggerScenarios":"Calling ParseGoroutineArgs with 'goroutines -with label' (kind parsed but no expression follows) - the kind itself was valid but its required expression is missing.","commonSituations":"A value containing spaces that the shell consumed; forgetting the label/regex after the kind; empty trailing token stripped by shell word-splitting.","solutions":["Add the expression after the kind, e.g. 'goroutines -with function main.worker'.","Quote expressions containing spaces: 'goroutines -with label \"my worker\"'.","Use 'running' or 'user' if you did not intend to pass a value."],"exampleFix":"// before\ncmd.ProcessLine(\"goroutines -with label\")\n// after\ncmd.ProcessLine(\"goroutines -with label worker-\")","handlingStrategy":"validation","validationCode":"func filterNeedsExpr(kind string) bool {\n\treturn kind != \"running\" && kind != \"user\"\n}\n// if filterNeedsExpr(kind), ensure an expression token follows before calling the API","typeGuard":null,"tryCatchPattern":"if _, err := api.ParseGoroutineArgs(args); err != nil {\n\treturn fmt.Errorf(\"filter needs expression: %v\", err)\n}","preventionTips":["Always supply an expression after curloc/userloc/label/function/file/line kinds","Quote expressions containing spaces","Use kind-only filters (running/user) when no value is intended"],"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"}