{"record":{"id":"587df53e4dc5b4db","repo":"go-delve/delve","slug":"expected-argument-after-size","errorCode":null,"errorMessage":"expected argument after -size","messagePattern":"expected argument after -size","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/api/command.go","lineNumber":249,"sourceCode":"\t\t\t\tout.Format, ok = fmtMapToPriFmt[arg]\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"%q is not a valid format\", arg)\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"-count\", \"-len\":\n\t\t\targ := nextArg()\n\t\t\tif arg == \"\" {\n\t\t\t\treturn nil, errors.New(\"expected argument after -count/-len\")\n\t\t\t}\n\t\t\tvar err error\n\t\t\tout.Count, err = strconv.ParseInt(arg, 0, 64)\n\t\t\tif err != nil || out.Count <= 0 {\n\t\t\t\treturn nil, errors.New(\"count/len must be a positive integer\")\n\t\t\t}\n\t\tcase \"-size\":\n\t\t\targ := nextArg()\n\t\t\tif arg == \"\" {\n\t\t\t\treturn nil, errors.New(\"expected argument after -size\")\n\t\t\t}\n\t\t\tvar err error\n\t\t\tout.Size, err = strconv.ParseInt(arg, 0, 64)\n\t\t\tif err != nil || out.Size <= 0 || out.Size > 8 {\n\t\t\t\treturn nil, errors.New(\"size must be a positive integer (<=8)\")\n\t\t\t}\n\t\tcase \"-x\":\n\t\t\tout.IsExpr = true\n\t\t\t// remaining args are going to be interpreted as expression\n\t\t\tout.Operand = strings.Join(args, \" \")\n\t\t\tbreak loop\n\t\tdefault:\n\t\t\tif len(args) > 0 {\n\t\t\t\treturn nil, fmt.Errorf(\"unknown option %q\", args[0])\n\t\t\t}\n\t\t\tout.Operand = cmd\n\t\t\tbreak loop // only one arg left to be evaluated as a uint\n\t\t}","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/api/command.go#L231-L267","documentation":"The `-size` flag of the examineMemory command requires a following argument. ParseExamineMemoryArg calls nextArg(); if the flag is the last token on the line (or followed only by whitespace) there is nothing to parse and Delve returns this error immediately.","triggerScenarios":"Invoking `examineMemory` with `-size` as the trailing token, e.g. `x -count 4 -size 0x1000` or `x -size` with no operand at all.","commonSituations":"Truncated commands from IDE argument builders that drop trailing empty values; hand-typed commands where the size was forgotten; template strings where a substitution was empty.","solutions":["Supply a value after -size, e.g. `x -size 8 <addr>`","Reorder flags so -size is not last, or remove it if the default size is fine","Check the client code that assembles the argument string for missing/empty substitutions"],"exampleFix":"// before\n\"x -count 4 -size 0xc000010000\"\n// after\n\"x -count 4 -size 8 0xc000010000\"","handlingStrategy":"validation","validationCode":"if sizeArg == \"\" {\n\treturn fmt.Errorf(\"-size requires a value\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure every flag has a trailing value when assembling args","Interpolate defaults for empty substitutions","Trim trailing flags from user input"],"tags":["dap","argument-parsing","cli"],"backgroundTag":"missing-required-argument","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}