{"record":{"id":"4356523cc7cb85cc","repo":"go-delve/delve","slug":"unsupported-expression-type-s-435652","errorCode":null,"errorMessage":"unsupported expression type: %s","messagePattern":"unsupported expression type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/dap/command.go","lineNumber":187,"sourceCode":"\t\tval, err := s.debugger.EvalVariableInScope(int64(goid), frame, 0, args.Operand, s.loadConfig())\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tswitch val.Kind {\n\t\tcase reflect.Pointer: // \"-x &myVar\" or \"-x myPtrVar\"\n\t\t\tif len(val.Children) < 1 {\n\t\t\t\treturn fmt.Errorf(\"bug? invalid pointer: %#v\", val).Error(), nil\n\t\t\t}\n\t\t\taddress = val.Children[0].Addr\n\n\t\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: // \"-x 0xc000079f20 + 8\" or -x 824634220320 + 8\n\t\t\tn, _ := constant.Int64Val(val.Value)\n\t\t\taddress = uint64(n)\n\t\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: // \"-x 0xc000079f20 + 8\" or -x 824634220320 + 8\n\t\t\taddress, _ = constant.Uint64Val(val.Value)\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unsupported expression type: %s\", val.Kind).Error(), nil\n\t\t}\n\t} else {\n\t\taddress, err = strconv.ParseUint(args.Operand, 0, 64)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"convert address into uintptr type failed, %s\", err).Error(), nil\n\t\t}\n\t}\n\n\tmemory, err := s.debugger.ExamineMemory(\n\t\taddress,\n\t\tmin(int(args.Count*args.Size), rpc2.ExamineMemoryLengthLimit),\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"examine memory error: %w\", err).Error(), nil\n\t}\n\n\treturn api.PrettyExamineMemory(uintptr(address), memory, true, args.Format, int(args.Size)), nil\n}","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/dap/command.go#L169-L205","documentation":"examineMemory's -x expression must evaluate to a pointer, an integer, or an unsigned integer kind; the resulting value's Kind is converted to a uint64 address. Any other kind (float, string, struct, map, etc.) hits the default case and produces this error naming the reflect.Kind.","triggerScenarios":"Calling examineMemory with '-x myFloatVar', '-x myStruct', or an arithmetic expression evaluating to a non-integer type, e.g. '-x addr + 0.5'.","commonSituations":"Passing a string variable holding a hex address instead of the literal; using float addresses from another tool's output; arithmetic that promotes to float; passing a struct field of non-integer type.","solutions":["Use an expression of integer/pointer type, or cast: '-x int(myVar)'.","Pass the raw address string without -x (it is parsed with strconv.ParseUint).","Convert a string address manually to a hex literal: '-x 0xc000010000' or plain '0xc000010000'."],"exampleFix":"// before\nexamineMemory -x addrString   // addrString is a string\n// after\nexamineMemory 0xc000010000","handlingStrategy":"type-guard","validationCode":"func isAddressKind(k reflect.Kind) bool {\n\tswitch k {\n\tcase reflect.Pointer, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,\n\t\treflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\treturn true\n\t}\n\treturn false\n} // check the evaluated Variable's Kind before invoking examineMemory -x","typeGuard":"func canUseAsAddress(val api.Variable) bool {\n\treturn isAddressKind(val.Kind)\n}","tryCatchPattern":"out, err := s.examineMemory(goid, frame, \"-x \"+expr)\nif err != nil {\n\tlog.Printf(\"%v - cast the expression to int or pass a literal address\", err)\n\treturn \"\"\n}","preventionTips":["Only use integer/pointer-valued expressions after -x","Cast non-integer expressions explicitly (e.g. int(var))","Pass hex literals directly without -x for string-encoded addresses"],"tags":["dap","type-error","memory-inspection","delve"],"backgroundTag":"unsupported-type-for-operation","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}