{"record":{"id":"45d21da936d84a73","repo":"go-delve/delve","slug":"q-is-not-a-valid-format","errorCode":null,"errorMessage":"%q is not a valid format","messagePattern":"%q is not a valid format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/api/command.go","lineNumber":233,"sourceCode":"\t\t\tif arg == \"\" {\n\t\t\t\treturn nil, errors.New(\"expected argument after -fmt\")\n\t\t\t}\n\t\t\tif arg == \"raw\" {\n\t\t\t\tout.RawOut = true\n\t\t\t} else {\n\t\t\t\tfmtMapToPriFmt := map[string]byte{\n\t\t\t\t\t\"oct\":         'o',\n\t\t\t\t\t\"octal\":       'o',\n\t\t\t\t\t\"hex\":         'x',\n\t\t\t\t\t\"hexadecimal\": 'x',\n\t\t\t\t\t\"dec\":         'd',\n\t\t\t\t\t\"decimal\":     'd',\n\t\t\t\t\t\"bin\":         'b',\n\t\t\t\t\t\"binary\":      'b',\n\t\t\t\t}\n\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","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/api/command.go#L215-L251","documentation":"ParseExamineMemoryArg parses options for the 'examine-memory' (x) command. The -fmt/-format flag accepts only formats present in fmtMapToPriFmt (hex, octal, decimal, bin/binary, etc.). Any other token after -fmt produces this error. It is a user input validation error, not a debugger state failure.","triggerScenarios":"Calling ParseExamineMemoryArg or the 'examine-memory' DAP command with e.g. '-fmt float64 0xc000010000' or '-format x addr' - 'x' and 'float64' are not keys in fmtMapToPriFmt.","commonSituations":"Using printf-style format letters ('x', 'd') instead of full names ('hex', 'decimal'); expecting arbitrary Go format verbs; copying syntax from gdb's x command.","solutions":["Use one of the accepted format names: hex, octal, decimal, bin, binary.","Check service/api/command.go for the current fmtMapToPriFmt keys - use exactly those strings.","Omit -fmt to use the default format."],"exampleFix":"// before\nexamine-memory -fmt x 0xc000010000\n// after\nexamine-memory -fmt hex 0xc000010000","handlingStrategy":"validation","validationCode":"var validFormats = map[string]bool{\"hex\": true, \"octal\": true, \"decimal\": true, \"bin\": true, \"binary\": true}\nif !validFormats(f) { return fmt.Errorf(\"unsupported format %q\", f) } // check before passing -fmt","typeGuard":null,"tryCatchPattern":"args, err := api.ParseExamineMemoryArg(argstr)\nif err != nil {\n\treturn fmt.Errorf(\"invalid examine-memory args: %v\", err)\n}","preventionTips":["Use full format names (hex, decimal, bin), not printf letters","Consult fmtMapToPriFmt in service/api/command.go for the exact accepted set","Omit -fmt to fall back to the default format"],"tags":["cli","argument-parsing","memory-inspection","delve"],"backgroundTag":"invalid-format-specifier","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}