go-delve/delve · error

wrong argument: %q is not a number

Error message

wrong argument: %q is not a number

What it means

The `disass` command with a raw address range (`disass <startpc> <endpc>`) parses both arguments with strconv.ParseInt. If the first argument is not a valid integer (base auto-detected), the command returns this error without doing any work.

Source

Thrown at pkg/terminal/command.go:2653

	var disasm api.AsmInstructions
	var disasmErr error

	switch cmd {
	case "":
		locs, _, err := t.client.FindLocation(ctx.Scope, "+0", true, t.substitutePathRules())
		if err != nil {
			return err
		}
		disasm, disasmErr = t.client.DisassemblePC(ctx.Scope, locs[0].PC, flavor)
	case "-a":
		v := config.Split2PartsBySpace(rest)
		if len(v) != 2 {
			return errDisasmUsage
		}
		startpc, err := strconv.ParseInt(v[0], 0, 64)
		if err != nil {
			return fmt.Errorf("wrong argument: %q is not a number", v[0])
		}
		endpc, err := strconv.ParseInt(v[1], 0, 64)
		if err != nil {
			return fmt.Errorf("wrong argument: %q is not a number", v[1])
		}
		disasm, disasmErr = t.client.DisassembleRange(ctx.Scope, uint64(startpc), uint64(endpc), flavor)
	case "-l":
		locs, _, err := t.client.FindLocation(ctx.Scope, rest, true, t.substitutePathRules())
		if err != nil {
			return err
		}
		if len(locs) != 1 {
			return errors.New("expression specifies multiple locations")
		}
		disasm, disasmErr = t.client.DisassemblePC(ctx.Scope, locs[0].PC, flavor)
	default:
		return errDisasmUsage
	}

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Use the location form instead: `disass -l main.foo`
  2. Prefix hex addresses with `0x`
  3. Use `disass -a <function>` to disassemble a whole function

Example fix

// before
disass 401200 4012ff
// after
disass 0x401200 0x4012ff
Defensive patterns

Strategy: try-catch

Try / catch

if _, err := strconv.ParseInt(arg, 0, 64); err != nil {
    return fmt.Errorf("%q is not a number; use disass -a <fn> or 0x-prefixed addresses", arg)
}

Prevention

When it happens

Trigger: Calling `disass` with two arguments where the first is not parseable as a number, e.g. `disass main.foo 0x401200` or `disass 0xZZ 0x400000`.

Common situations: Pasting a function name into the address-range form instead of using `-a`/`-l`; missing the `0x` prefix so a hex address fails to parse; copying an address with stray characters.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/b1b6189ff76131ab. Report an issue: GitHub.