{"record":{"id":"6924083ffc58987d","repo":"larksuite/cli","slug":"unsupported-range-form-q-need-rectangular-a1-b2","errorCode":null,"errorMessage":"unsupported range form %q (need rectangular A1:B2)","messagePattern":"unsupported range form %q \\(need rectangular A1:B2\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/sheets/lark_sheet_workbook.go","lineNumber":2121,"sourceCode":"\tif idx := strings.Index(rangeStr, \"!\"); idx >= 0 {\n\t\trangeStr = rangeStr[idx+1:]\n\t}\n\trangeStr = strings.TrimSpace(rangeStr)\n\tif rangeStr == \"\" {\n\t\treturn 0, 0, 0, 0, fmt.Errorf(\"empty range\") //nolint:forbidigo // intermediate error; callers wrap it into a typed validation error with flag/param context\n\t}\n\tparts := strings.SplitN(rangeStr, \":\", 2)\n\tif len(parts) == 1 {\n\t\tcol, row, ok := splitCellRef(parts[0])\n\t\tif !ok {\n\t\t\treturn 0, 0, 0, 0, fmt.Errorf(\"invalid cell ref %q\", parts[0]) //nolint:forbidigo // intermediate error; callers wrap it into a typed validation error with flag/param context\n\t\t}\n\t\treturn col, row, col, row, nil\n\t}\n\tstartCol, startRow, ok1 := splitCellRef(parts[0])\n\tendCol, endRow, ok2 := splitCellRef(parts[1])\n\tif !ok1 || !ok2 {\n\t\treturn 0, 0, 0, 0, fmt.Errorf(\"unsupported range form %q (need rectangular A1:B2)\", rangeStr) //nolint:forbidigo // intermediate error; callers wrap it into a typed validation error with flag/param context\n\t}\n\tif endRow < startRow || endCol < startCol {\n\t\treturn 0, 0, 0, 0, fmt.Errorf(\"end %q must be at or after start %q\", parts[1], parts[0]) //nolint:forbidigo // intermediate error; callers wrap it into a typed validation error with flag/param context\n\t}\n\treturn startCol, startRow, endCol, endRow, nil\n}\n\n// mergeWorkbookCreateStyle merges one cell_styles op's style map into a cell.\n// cell_styles / border_styles are nested submaps: they are deep-merged one level\n// (field-wise, last write wins) so overlapping cell_styles ops accumulate fields\n// rather than the later op's submap wholesale-replacing the earlier one. A fresh\n// submap is allocated each merge so the op.Style shared across the range's cells\n// is never mutated.\nfunc mergeWorkbookCreateStyle(cell interface{}, style map[string]interface{}) {\n\tif len(style) == 0 {\n\t\treturn\n\t}\n\tm, ok := cell.(map[string]interface{})","sourceCodeStart":2103,"sourceCodeEnd":2139,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/sheets/lark_sheet_workbook.go#L2103-L2139","documentation":"The sheet workbook range parser only accepts a rectangular A1:B2 style range: two cell references separated by a colon, each a column-letter + row-number cell ref. It throws this error when the given range string does not split into exactly two parseable cell references. It is an intermediate error; the calling command wraps it into a typed validation error with flag/param context.","triggerScenarios":"Calling a sheet workbook shortcut with a --range (or equivalent) flag set to a string that is not '<cell>:<cell>', e.g. 'A1', 'A1:', ':B2', 'A1:B2:C3', 'Sheet1!A1:B2' if the qualifier was not stripped, or references like '1A:2B' that splitCellRef cannot parse.","commonSituations":"Users copying range syntax from Excel UI ('A1' single cell in the two-part parser), passing whole-column ranges ('A:C'), named ranges, or including extra whitespace/formatting the parser does not accept.","solutions":["Reformat the value as a rectangular range 'startCell:endCell', e.g. 'A1:B2'; for a single cell use the single-cell form accepted by the command.","Remove any sheet-name prefix or extra separators (spaces, extra colons) from the range string.","Run the command with --help or `schema` to see the documented --range format and examples.","If wrapping this parser yourself, surface the returned error with the flag/param context as the callers do."],"exampleFix":"// before\n--range \"A1\"\n--range \"Sheet1!A1:B2\"\n// after\n--range \"A1:B2\"","handlingStrategy":"validation","validationCode":"var rangeRe = regexp.MustCompile(`^[A-Za-z]+[1-9][0-9]*:[A-Za-z]+[1-9][0-9]*$`)\nfunc validRectRange(s string) bool { return rangeRe.MatchString(strings.TrimSpace(s)) }\nif !validRectRange(rangeStr) { return fmt.Errorf(\"bad --range %q; use A1:B2\", rangeStr) }","typeGuard":"func isRectRange(s string) bool {\n\tparts := strings.SplitN(s, \":\", 2)\n\treturn len(parts) == 2 && isCellRef(parts[0]) && isCellRef(parts[1])\n}","tryCatchPattern":null,"preventionTips":["Always format sheet ranges as 'TopLeftCell:BottomRightCell'.","Strip sheet qualifiers and whitespace before validation.","Add a regex pre-check on any user-supplied range flag."],"tags":["validation","sheets","range-parsing","cli"],"backgroundTag":"invalid-range-format","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}