micro-editor/micro · warning

Not enough arguments

Error message

Not enough arguments

What it means

Returned by (*BufPane).parseLineCol (internal/action/command.go:948) when the args slice is empty. parseLineCol is the shared argument parser for GotoCmd (:goto, command.go:909) and JumpCmd (:jump, command.go:930); it expects at least one argument shaped 'line' or 'line:col' (also ':col'). Zero arguments means the command was invoked bare, so it refuses instead of defaulting.

Source

Thrown at internal/action/command.go:948

	line, col, err := h.parseLineCol(args)
	if err != nil {
		InfoBar.Error(err)
		return
	}

	line = h.Buf.GetActiveCursor().Y + 1 + line
	line = util.Clamp(line-1, 0, h.Buf.LinesNum()-1)
	col = util.Clamp(col-1, 0, util.CharacterCount(h.Buf.LineBytes(line)))

	h.RemoveAllMultiCursors()
	h.Cursor.Deselect(true)
	h.GotoLoc(buffer.Loc{col, line})
}

// parseLineCol is a helper to parse the input of GotoCmd and JumpCmd
func (h *BufPane) parseLineCol(args []string) (line int, col int, err error) {
	if len(args) <= 0 {
		return 0, 0, errors.New("Not enough arguments")
	}

	line, col = 0, 0
	if strings.Contains(args[0], ":") {
		parts := strings.SplitN(args[0], ":", 2)
		line, err = strconv.Atoi(parts[0])
		if err != nil {
			return 0, 0, err
		}
		col, err = strconv.Atoi(parts[1])
		if err != nil {
			return 0, 0, err
		}
	} else {
		line, err = strconv.Atoi(args[0])
		if err != nil {
			return 0, 0, err
		}

View on GitHub (pinned to 1c8b82b32e)

Solutions

  1. Supply the target: > goto 42, > goto 42:7, or column-only > goto :7 (1-based; both values are clamped to the buffer)
  2. In Lua, pass the argument through: DoCommand("goto 10")
  3. If you wanted an interactive prompt, bind and use the built-in that asks for input instead of relying on bare goto

Example fix

// before
> goto
# Not enough arguments

// after
> goto 120:5
Defensive patterns

Strategy: validation

Validate before calling

// Require an argument before invoking Goto/Jump behavior
func safeGoto(h *BufPane, args []string) {
    if len(args) == 0 {
        InfoBar.Error("usage: goto line[:col]  (e.g. 42 or 42:7)")
        return
    }
    h.GotoCmd(args)
}

Try / catch

// parseLineCol returns the error; GotoCmd/JumpCmd already report it via InfoBar.
// Callers that reuse parseLineCol directly:
line, col, err := h.parseLineCol(args)
if err != nil {
    if err.Error() == "Not enough arguments" {
        InfoBar.Error("usage: goto line[:col]")
        return
    }
    InfoBar.Error(err) // Atoi failures like 'goto abc' arrive here
    return
}

Prevention

When it happens

Trigger: Executing > goto or > jump with no arguments in the command bar; a Lua macro calling DoCommand("goto") without a target; keybinding mapped to 'Goto' without supplying count/args (e.g. pressing Ctrl-g style binding that calls GotoCmd directly with empty args).

Common situations: New users expecting bare 'goto' to open a line prompt like other editors; plugins invoking the goto action programmatically without arguments; fat-fingered macros.

Related errors


AI-assisted analysis of micro-editor/micro@1c8b82b32e (2026-08-15). Data as JSON: /api/errors/be6ca7a620311f27. Report an issue: GitHub.