larksuite/cli · error

expected "start:end" or single element

Error message

expected "start:end" or single element

What it means

Guard in parseA1Range: the range contains more than one colon, matching neither the "start:end" form nor a single element. Intermediate error wrapped by callers.

Source

Thrown at shortcuts/sheets/lark_sheet_sheet_structure.go:822

		}
	}
	return input, nil
}

// ─── A1 parsing helpers ───────────────────────────────────────────────

// parseA1Range parses an A1 closed range ("3:7" / "5" / "C:F" / "C") into
// the inferred dimension ("row" or "column") and 0-based inclusive indices.
// Single-element form yields startIdx == endIdx. Mixing digits and letters
// across the two sides ("3:C") is rejected.
func parseA1Range(s string) (dimension string, startIdx, endIdx int, err error) {
	s = strings.TrimSpace(s)
	if s == "" {
		return "", 0, 0, fmt.Errorf("range is empty") //nolint:forbidigo // intermediate error; callers wrap it into a typed flag validation error
	}
	parts := strings.Split(s, ":")
	if len(parts) > 2 {
		return "", 0, 0, fmt.Errorf("expected \"start:end\" or single element") //nolint:forbidigo // intermediate error; callers wrap it into a typed flag validation error
	}
	dim1, idx1, err := parseA1Position(parts[0])
	if err != nil {
		return "", 0, 0, err
	}
	if len(parts) == 1 {
		return dim1, idx1, idx1, nil
	}
	dim2, idx2, err := parseA1Position(parts[1])
	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
	}

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Use at most one colon: `start:end` or a single element
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shortcuts/sheets/lark_sheet_sheet_structure.go:822 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/66d6c10b5ad944cb. Report an issue: GitHub.