larksuite/cli · error

position is empty

Error message

position is empty

What it means

Guard in parseA1Position: the position element is empty or whitespace-only, so no row/column can be derived. Intermediate error wrapped by callers.

Source

Thrown at shortcuts/sheets/lark_sheet_sheet_structure.go:850

	if err != nil {
		return "", 0, 0, err
	}
	if dim1 != dim2 {
		return "", 0, 0, fmt.Errorf("cannot mix row (digits) and column (letters) in one range") //nolint:forbidigo // intermediate error; callers wrap it into a typed flag validation error
	}
	if idx2 < idx1 {
		return "", 0, 0, fmt.Errorf("end position is before start") //nolint:forbidigo // intermediate error; callers wrap it into a typed flag validation error
	}
	return dim1, idx1, idx2, nil
}

// parseA1Position parses a single A1 position element: pure digits → row
// (1-based number, returned as 0-based idx); pure letters → column (letters
// case-insensitive, "A" → 0, "AA" → 26).
func parseA1Position(s string) (dimension string, idx int, err error) {
	s = strings.TrimSpace(s)
	if s == "" {
		return "", 0, fmt.Errorf("position is empty") //nolint:forbidigo // intermediate error; callers wrap it into a typed flag validation error
	}
	isDigits := true
	isLetters := true
	for _, r := range s {
		if r < '0' || r > '9' {
			isDigits = false
		}
		if !((r >= 'A' && r <= 'Z') || (r >= 'a' && r <= 'z')) {
			isLetters = false
		}
	}
	if isDigits {
		n, _ := strconv.Atoi(s)
		if n <= 0 {
			return "", 0, fmt.Errorf("row number must be >= 1 (got %q)", s) //nolint:forbidigo // intermediate error; callers wrap it into a typed flag validation error
		}
		return "row", n - 1, nil
	}

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Supply both sides of the range or drop the colon
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shortcuts/sheets/lark_sheet_sheet_structure.go:850 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/8ed69e9b8fcc7096. Report an issue: GitHub.