{"record":{"id":"32f3538101f91b1c","repo":"larksuite/cli","slug":"invalid-cell-ref-q","errorCode":null,"errorMessage":"invalid cell ref %q","messagePattern":"invalid cell ref %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/sheets/lark_sheet_workbook.go","lineNumber":2114,"sourceCode":"\t\treturn input, \"modify_sheet_structure\"\n\tdefault:\n\t\treturn nil, \"\"\n\t}\n}\n\nfunc workbookCreateStyleRangeBounds(rangeStr string) (startCol, startRow, endCol, endRow int, err error) {\n\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","sourceCodeStart":2096,"sourceCodeEnd":2132,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/sheets/lark_sheet_workbook.go#L2096-L2132","documentation":"workbookCreateStyleRangeBounds splits a range on ':' and parses each side as a cell reference like 'A1'. This error is returned when a single-cell range (no colon) is not a valid cell ref — the token isn't a column-letters + row-number combination. It is an intermediate error wrapped by callers into a typed validation error with flag/param context.","triggerScenarios":"lark sheet table put with a styles/merge range of 'A', '3', 'AA', '1A', or other strings without a colon that splitCellRef cannot parse into a (col,row) pair.","commonSituations":"Typos like 'A1:' variants, whole-column 'A:A' or whole-row '1:1' style ranges, or using named ranges instead of A1 notation.","solutions":["Use a valid A1 cell reference, e.g. 'B2' for a single cell or 'B2:D4' for a block.","Replace whole-column/whole-row ranges ('A:A', '1:1') with explicit bounded ranges ('A1:A100').","Check the typed validation error's context to see exactly which token failed to parse.","Validate with a regex like ^[A-Za-z]+[1-9][0-9]*$ before submitting."],"exampleFix":"// before\n{\"styles\": [{\"range\": \"A:A\", \"bold\": true}]}\n// after\n{\"styles\": [{\"range\": \"A1:A100\", \"bold\": true}]}","handlingStrategy":"validation","validationCode":"var cellRefRe = regexp.MustCompile(`^[A-Za-z]{1,3}[1-9][0-9]*$`)\nfunc validRange(r string) bool {\n\tif i := strings.Index(r, \"!\"); i >= 0 { r = r[i+1:] }\n\tparts := strings.SplitN(r, \":\", 2)\n\tfor _, p := range parts { if !cellRefRe.MatchString(strings.TrimSpace(p)) { return false } }\n\treturn len(parts) >= 1\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use A1 notation for all style ranges; expand whole-column/row ranges to explicit bounds.","Regex-validate cell refs before submitting payloads.","Never use named ranges where A1 refs are expected."],"tags":["validation","styles","sheets"],"backgroundTag":"invalid-cell-reference","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"}