go-delve/delve · error

%q is not a number

Error message

%q is not a number

What it means

`display -del <n>` removes a previously configured display expression by its numeric index. If the argument after `-del` cannot be parsed as an integer with strconv.Atoi, this error is returned.

Source

Thrown at pkg/terminal/command.go:3443

	)
	switch {
	case args == "":
		t.printDisplays()

	case strings.HasPrefix(args, addOption):
		args = strings.TrimSpace(args[len(addOption):])
		fmtstr, args := parseFormatArg(args)
		if args == "" {
			return errors.New("not enough arguments")
		}
		t.addDisplay(args, fmtstr)
		t.printDisplay(len(t.displays) - 1)

	case strings.HasPrefix(args, delOption):
		args = strings.TrimSpace(args[len(delOption):])
		n, err := strconv.Atoi(args)
		if err != nil {
			return fmt.Errorf("%q is not a number", args)
		}
		return t.removeDisplay(n)

	default:
		return errors.New("wrong arguments")
	}
	return nil
}

func dump(t *Term, ctx callContext, args string) error {
	if args == "" {
		return errors.New("not enough arguments")
	}
	dumpState, err := t.client.CoreDumpStart(args)
	if err != nil {
		return err
	}
	for {

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Run `display` with no arguments to list displays and their indices
  2. Use the decimal index shown in the listing: `display -del 2`
  3. Delete by expression is not supported; only numeric indices work

Example fix

// before
display -del myvar
// after
display
display -del 0
Defensive patterns

Strategy: try-catch

Try / catch

n, err := strconv.Atoi(arg)
if err != nil {
    return fmt.Errorf("-del expects an index; run 'display' to list them")
}

Prevention

When it happens

Trigger: Running `display -del x` or `display -del 0x1` where the index argument is not a plain decimal integer.

Common situations: Trying to delete a display by its expression name instead of its index; pasting a hex-formatted index; extra whitespace/token after -del (though trimmed).

Related errors


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