go-delve/delve · error
convert address into uintptr type failed, %s
Error message
convert address into uintptr type failed, %s
What it means
In DAP's examineMemory REPL command, when the operand is not an expression (no -x flag), Delve parses it with strconv.ParseUint. If the raw operand string is not a valid base-prefixed number (hex 0x, octal 0, decimal), parsing fails and this error is returned. It means the address argument supplied to the 'examine memory' command is not a valid numeric literal.
Source
Thrown at service/dap/command.go:192
switch val.Kind {
case reflect.Pointer: // "-x &myVar" or "-x myPtrVar"
if len(val.Children) < 1 {
return fmt.Errorf("bug? invalid pointer: %#v", val).Error(), nil
}
address = val.Children[0].Addr
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: // "-x 0xc000079f20 + 8" or -x 824634220320 + 8
n, _ := constant.Int64Val(val.Value)
address = uint64(n)
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: // "-x 0xc000079f20 + 8" or -x 824634220320 + 8
address, _ = constant.Uint64Val(val.Value)
default:
return fmt.Errorf("unsupported expression type: %s", val.Kind).Error(), nil
}
} else {
address, err = strconv.ParseUint(args.Operand, 0, 64)
if err != nil {
return fmt.Errorf("convert address into uintptr type failed, %s", err).Error(), nil
}
}
memory, err := s.debugger.ExamineMemory(
address,
min(int(args.Count*args.Size), rpc2.ExamineMemoryLengthLimit),
)
if err != nil {
return fmt.Errorf("examine memory error: %w", err).Error(), nil
}
return api.PrettyExamineMemory(uintptr(address), memory, true, args.Format, int(args.Size)), nil
}
func (s *Session) evaluateConfig(_, _ int, expr string) (string, error) {
argv := config.Split2PartsBySpace(expr)
name := argv[0]
if name == "-list" {View on GitHub (pinned to a23773e6c3)
Solutions
- Verify the operand is a plain numeric literal with a valid Go prefix (0x hex, 0o/0 octal, decimal) and no whitespace, commas, or decorations.
- If you meant to pass a variable or pointer expression, use the -x flag: 'examine-memory -x &myVar' or 'examine-memory -x myPtr'.
- If the address came from an expression result, use '-x <expr>' so Delve evaluates it via EvalVariableInScope instead of strconv.
- Check the value fits in 64 bits; addresses above 2^64 will fail ParseUint.
Example fix
// before examine-memory 0xc000,079f20 // after examine-memory 0xc000079f20 // or, for expressions: examine-memory -x &buf
Defensive patterns
Strategy: validation
Validate before calling
addr := strings.TrimSpace(operand)
if _, err := strconv.ParseUint(addr, 0, 64); err != nil {
// reject before calling: not a valid address literal
}
// hint: Go's ParseUint with base 0 expects 0x/0o/0b prefixes or decimal Prevention
- Always use the -x flag for expressions or symbol names
- Copy addresses without commas or thousands separators
- Trim whitespace from operands before sending the command
When it happens
Trigger: Calling the DAP evaluate command with 'examine-memory <addr>' where <addr> contains typos, '0x' prefix typos, decimal commas, trailing whitespace/newlines, variable names without '-x', or a value exceeding uint64 range.
Common situations: Copy-pasting an address from a tool that formats it differently (e.g. '0xC000... ' with spaces or commas like 0xc000,079f20); passing a symbol name like &myVar without the -x expression flag; a frontend sending a stringified address with scientific notation.
Related errors
- bad arguments: %w
- count/len must be a positive integer
- expected argument after -size
- size must be a positive integer (<=8)
- no address specified
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/96623005293f1a28.
Report an issue: GitHub.