{"record":{"id":"142b156afac697af","repo":"larksuite/cli","slug":"empty-range","errorCode":null,"errorMessage":"empty range","messagePattern":"empty range","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/sheets/lark_sheet_workbook.go","lineNumber":2108,"sourceCode":"\t\tif op.FreezeRows > 0 {\n\t\t\tinput[\"freeze_rows\"] = op.FreezeRows\n\t\t}\n\t\tif op.FreezeCols > 0 {\n\t\t\tinput[\"freeze_columns\"] = op.FreezeCols\n\t\t}\n\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","sourceCodeStart":2090,"sourceCodeEnd":2126,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/sheets/lark_sheet_workbook.go#L2090-L2126","documentation":"workbookCreateStyleRangeBounds parses a style/merge range string like 'Sheet1!A1:C3' into column/row bounds. This error is returned when the range portion is empty after stripping any 'Sheet!' prefix and trimming whitespace. It is an intermediate error; callers (parseWorkbookCreateCellStyleOp, parseWorkbookCreateMergeOp) wrap it into a typed validation error with flag/param context.","triggerScenarios":"lark sheet table put with a styles or merge entry whose 'range' field is an empty string or only a sheet prefix like 'Sheet1!' with nothing after the '!'.","commonSituations":"Hand-written style JSON where the range key was left empty; template-driven payloads where a variable that should hold the range expanded to nothing.","solutions":["Provide a concrete range like 'A1:C3' (optionally with a 'SheetName!' prefix) in the style/merge entry.","Remove the empty range entry if the style op was added unintentionally.","Check the typed validation error's flag/param context to find which styles entry is empty.","Validate ranges in your payload generator before calling the put."],"exampleFix":"// before\n{\"styles\": [{\"range\": \"\", \"bg\": \"#EEE\"}]}\n// after\n{\"styles\": [{\"range\": \"A1:C3\", \"bg\": \"#EEE\"}]}","handlingStrategy":"validation","validationCode":"func hasRange(r string) bool {\n\tif i := strings.Index(r, \"!\"); i >= 0 { r = r[i+1:] }\n\treturn strings.TrimSpace(r) != \"\"\n}\n// before the put:\nfor _, st := range styles { if !hasRange(st.Range) { return fmt.Errorf(\"empty range in %v\", st) } }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always emit a concrete A1 range in style/merge entries.","Reject empty or prefix-only ranges in payload generators.","Test style payloads with a schema/validator before the API call."],"tags":["validation","styles","sheets"],"backgroundTag":"invalid-range-string","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"}