{"record":{"id":"72cf686e272592a7","repo":"go-delve/delve","slug":"size-must-be-a-positive-integer-8","errorCode":null,"errorMessage":"size must be a positive integer (<=8)","messagePattern":"size must be a positive integer \\(<=8\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/api/command.go","lineNumber":254,"sourceCode":"\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}\n\t}\n\n\tif len(out.Operand) == 0 {\n\t\treturn nil, errors.New(\"no address specified\")\n\t}","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/api/command.go#L236-L272","documentation":"The `-size` flag controls byte width per memory chunk and must be an integer between 1 and 8 inclusive, since Delve reads machine-word-sized chunks. Any non-numeric value, a value <= 0, or a value > 8 produces this error.","triggerScenarios":"`examineMemory` with `-size 0`, `-size 16`, `-size abc`, or any value outside 1..8; also when a client computes size from a type's byte size larger than 8 (e.g. a 16-byte struct).","commonSituations":"Reading wider types (int128, structs, big floats) and passing their full byte size; confusing -size (per-chunk bytes, max 8) with total byte count; IDE form fields unconstrained up to 64.","solutions":["Use a -size value between 1 and 8 (typically 1, 2, 4, or 8)","Express large reads via a bigger -count instead of a bigger -size","Clamp client-side to min(max(size,1),8) before sending"],"exampleFix":"// before\n\"x -count 4 -size 16 0xc000010000\"\n// after\n\"x -count 16 -size 1 0xc000010000\"","handlingStrategy":"validation","validationCode":"func clampSize(n int64) int64 {\n\tif n < 1 { return 1 }\n\tif n > 8 { return 8 }\n\treturn n\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp size into [1,8] before sending","Convert large byte-size reads into larger counts","Document that -size is per-chunk width, not total"],"tags":["dap","argument-parsing","memory"],"backgroundTag":"invalid-argument-value","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}