{"record":{"id":"d7f206582d880349","repo":"go-delve/delve","slug":"unknown-option-q","errorCode":null,"errorMessage":"unknown option %q","messagePattern":"unknown option %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/api/command.go","lineNumber":263,"sourceCode":"\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}\n\n\treturn &out, nil\n}\n","sourceCodeStart":245,"sourceCodeEnd":276,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/api/command.go#L245-L276","documentation":"ParseExamineMemoryArg iterates the argument list and throws this error for an option token it does not recognize while other arguments remain. The unknown token (args[0]) is reported verbatim with %q quoting.","triggerScenarios":"Calling ParseExamineMemoryArg with an unknown flag, e.g. 'examine-memory -size 8 0xc000010000' or 'examine-memory -x 0xc000010000' (-x belongs to the expression form only when recognized).","commonSituations":"Inventing flags like -size or -width; mixing DAP 'examineMemory' option syntax with terminal syntax; forgetting that the raw address must be the last bare argument.","solutions":["Use only supported options: -fmt/-format, -count/-len, -x and their accepted values.","Remove or correct the unrecognized token reported in the error message.","If passing an address, give it as the final bare operand (hex/decimal literal) rather than behind a flag."],"exampleFix":"// before\nexamine-memory -size 8 -x 0xc000010000\n// after\nexamine-memory -count 8 -x 0xc000010000","handlingStrategy":"validation","validationCode":"var allowedOpts = map[string]bool{\"-fmt\": true, \"-format\": true, \"-count\": true, \"-len\": true, \"-x\": true}\n// pre-scan tokens; any '-'-prefixed token not in allowedOpts will be rejected\nfor _, a := range tokens {\n\tif strings.HasPrefix(a, \"-\") && !allowedOpts[a] { return fmt.Errorf(\"unknown option %q\", a) }\n}","typeGuard":null,"tryCatchPattern":"args, err := api.ParseExamineMemoryArg(argstr)\nif err != nil {\n\treturn fmt.Errorf(\"examine-memory rejected args: %v\", err)\n}","preventionTips":["Stick to documented flags: -fmt/-format, -count/-len, -x","Place the address as the final bare operand","Do not mix gdb-style options with delve's"],"tags":["cli","argument-parsing","memory-inspection","delve"],"backgroundTag":"invalid-command-flag","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}