{"record":{"id":"e4d7849d0b52b440","repo":"larksuite/cli","slug":"unsupported-range-form-q-need-rectangular-a1-b2-e4d784","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_write_cells.go","lineNumber":1156,"sourceCode":"\t}\n\tif body == \"\" {\n\t\treturn out, fmt.Errorf(\"empty range\") //nolint:forbidigo // intermediate error; callers wrap it into a typed --range/--source-range validation error\n\t}\n\tparts := strings.SplitN(body, \":\", 2)\n\tout.start = strings.TrimSpace(parts[0])\n\tstartCol, startRow, ok := splitCellRef(out.start)\n\tout.col, out.row = startCol, startRow\n\tif len(parts) == 1 {\n\t\t// single cell, e.g. \"A1\"\n\t\tif !ok {\n\t\t\treturn cellRange{}, fmt.Errorf(\"invalid cell ref %q\", parts[0]) //nolint:forbidigo // intermediate error; callers wrap it into a typed --range/--source-range validation error\n\t\t}\n\t\tout.rows, out.cols, out.anchored = 1, 1, true\n\t\treturn out, nil\n\t}\n\tendCol, endRow, okEnd := splitCellRef(parts[1])\n\tif !ok || !okEnd {\n\t\treturn cellRange{}, fmt.Errorf(\"unsupported range form %q (need rectangular A1:B2)\", body) //nolint:forbidigo // intermediate error; callers wrap it into a typed --range/--source-range validation error\n\t}\n\tif endRow < startRow || endCol < startCol {\n\t\treturn cellRange{}, 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 --range/--source-range validation error\n\t}\n\tout.rows, out.cols = endRow-startRow+1, endCol-startCol+1\n\treturn out, nil\n}\n\nfunc rangeDimensions(rangeStr string) (rows, cols int, err error) {\n\tr, err := parseCellRange(rangeStr)\n\tif err != nil {\n\t\treturn 0, 0, err\n\t}\n\treturn r.rows, r.cols, nil\n}\n\n// splitCellRef parses \"A1\" → (col=0, row=0, true). Returns false for any\n// non-rectangular form (pure column \"A\", pure row \"1\", invalid chars).","sourceCodeStart":1138,"sourceCodeEnd":1174,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/sheets/lark_sheet_write_cells.go#L1138-L1174","documentation":"When a range contains a colon, parseCellRange validates both halves with splitCellRef; if either the start or end half is not a valid cell reference, it reports 'unsupported range form' with the full body. This is the range-form counterpart of the single-cell invalid-ref error and is wrapped by callers into a typed --range/--source-range validation error.","triggerScenarios":"Passing two-part ranges where either side is malformed, e.g. 'A1:B2:C3' (extra part beyond the first colon is glued into the end half), 'A1:2B', ':B2', 'A1:', or column-only ranges like 'A:C'.","commonSituations":"Using Excel-style whole-column/whole-row ranges, named ranges, multi-area ranges ('A1:B2 C3:D4'), or accidental extra colons/whitespace.","solutions":["Reformat as exactly two valid cell refs joined by one colon, e.g. 'A1:B2'.","Replace whole-column ('A:C') or whole-row ('1:1') specs with explicit bounding cells like 'A1:C100'.","Remove extra spaces around the colon; splitCellRef requires tight cell refs.","Verify with --help/schema examples of the accepted --range syntax."],"exampleFix":"// before\n--range \"A:C\"\n--range \"A1:B2:C3\"\n// after\n--range \"A1:C100\"\n--range \"A1:B2\"","handlingStrategy":"validation","validationCode":"parts := strings.Split(strings.TrimSpace(rng), \":\")\nif len(parts) != 2 || !cellRe.MatchString(parts[0]) || !cellRe.MatchString(parts[1]) {\n\treturn fmt.Errorf(\"--range %q: use exactly A1:B2\", rng)\n}","typeGuard":"func isRectRange(s string) bool {\n\tparts := strings.SplitN(s, \":\", 2)\n\treturn len(parts) == 2 && isCellRef(parts[0]) && isCellRef(strings.TrimSpace(parts[1]))\n}","tryCatchPattern":null,"preventionTips":["Exactly one colon separating two valid cell refs — no extra areas or column-only spans.","Replace 'A:C' style spans with explicit bounding cells."],"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"}