go-delve/delve · error

not enough arguments

Error message

not enough arguments

What it means

For 'frame <n>' the frame number is required; this error is returned when frameCommand is invoked with an empty argument in frameSet direction (i.e. the plain 'frame' command). 'up'/'down' default to 1 frame, but 'frame' must be told which frame to select.

Source

Thrown at pkg/terminal/command.go:1019

		fmt.Fprintf(t.stdout, "Switched from %d to %d (thread %d)\n", selectedGID(oldState), gid, newState.CurrentThread.ID)
		return nil
	}

	var err error
	ctx.Scope.GoroutineID, err = strconv.ParseInt(args[0], 10, 64)
	if err != nil {
		return err
	}
	return c.CallWithContext(args[1], t, ctx)
}

// Handle "frame", "up", "down" commands.
func (c *Commands) frameCommand(t *Term, ctx callContext, argstr string, direction frameDirection) error {
	frame := 1
	arg := ""
	if len(argstr) == 0 {
		if direction == frameSet {
			return errors.New("not enough arguments")
		}
	} else {
		args := config.Split2PartsBySpace(argstr)
		var err error
		if frame, err = strconv.Atoi(args[0]); err != nil {
			return err
		}
		if len(args) > 1 {
			arg = args[1]
		}
	}
	switch direction {
	case frameUp:
		frame = c.frame + frame
	case frameDown:
		frame = c.frame - frame
	}
	if len(arg) > 0 {

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Provide a frame number: 'frame 0' for the topmost frame
  2. Use 'up'/'down' to move relatively, or 'frame up'/'frame down'
  3. Run 'stack' first to see valid frame indices

Example fix

// before
(dlv) frame
// after
(dlv) frame 0
Defensive patterns

Strategy: validation

Validate before calling

// Require a frame number for 'frame'
if cmd == "frame" && len(strings.Fields(argstr)) == 0 {
    return errors.New("usage: frame <n>; use 'up'/'down' for relative moves")
}
if n, err := strconv.Atoi(argstr); err != nil || n < 0 {
    return fmt.Errorf("frame must be a non-negative integer")
}

Try / catch

err := term.ExecuteCommand("frame")
if err != nil && strings.Contains(err.Error(), "not enough arguments") {
    // default to frame 0 or show stack
st, _ := client.Stacktrace(goroutineID, 20, 0, nil)
    printStack(st)
}

Prevention

When it happens

Trigger: Typing 'frame' with no argument; non-numeric arguments instead raise a strconv error.

Common situations: Expecting 'frame' to default to frame 0 or to show the current frame like in GDB.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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