{"record":{"id":"9fb6758aeef0c6ce","repo":"larksuite/cli","slug":"writing-rows-d-d-w","errorCode":null,"errorMessage":"writing rows %d-%d: %w","messagePattern":"writing rows (.+?)-(.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/sheets/lark_sheet_table_io.go","lineNumber":930,"sourceCode":"\n\twrites := 0\n\tfor start := 0; start < len(matrix); start += rowsPerBatch {\n\t\tend := start + rowsPerBatch\n\t\tif end > len(matrix) {\n\t\t\tend = len(matrix)\n\t\t}\n\t\tbatchRange := fmt.Sprintf(\"%s%d:%s%d\", startCol, baseRow+start+1, endCol, baseRow+end)\n\t\tinput := map[string]interface{}{\n\t\t\t\"excel_id\": token,\n\t\t\t\"sheet_id\": sheetID,\n\t\t\t\"range\":    batchRange,\n\t\t\t\"cells\":    matrix[start:end],\n\t\t}\n\t\tif !allowOverwrite {\n\t\t\tinput[\"allow_overwrite\"] = false\n\t\t}\n\t\tif _, err := callTool(ctx, runtime, token, ToolKindWrite, \"set_cell_range\", input); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"writing rows %d-%d: %w\", start+1, end, err) //nolint:forbidigo // intermediate error; surfaced as a partial_success message string via tablePutPartial, not a typed final error\n\t\t}\n\t\twrites++\n\t}\n\tif err := applyWorkbookCreateVisualOps(ctx, runtime, token, sheetID, styles); err != nil {\n\t\treturn nil, fmt.Errorf(\"applying visual styles: %w\", err) //nolint:forbidigo // intermediate error; surfaced as a partial_success message string via tablePutPartial, not a typed final error\n\t}\n\treturn map[string]interface{}{\n\t\t\"name\":      s.Name,\n\t\t\"sheet_id\":  sheetID,\n\t\t\"range\":     fmt.Sprintf(\"%s%d:%s%d\", startCol, baseRow+1, endCol, baseRow+len(matrix)),\n\t\t\"data_rows\": len(s.Rows),\n\t\t\"columns\":   writeCols,\n\t\t\"writes\":    writes,\n\t\t\"mode\":      writeModeName(s),\n\t}, nil\n}\n\n// writeModeName normalizes the sheet's write mode to a non-empty label for","sourceCodeStart":912,"sourceCodeEnd":948,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/sheets/lark_sheet_table_io.go#L912-L948","documentation":"writeSheetData writes row batches through the set_cell_range tool; this error wraps a failure of one such batch write, including the failing 1-based row span (start+1 to end). It is an intermediate error surfaced as a partial_success message string via tablePutPartial, meaning earlier batches may already have been written when it fires.","triggerScenarios":"Calling lark sheet table put when a set_cell_range call fails mid-write: allow_overwrite=false and the target range collides with existing non-empty data, grid too small, or an API-level rejection (permission, rate limit, invalid range).","commonSituations":"Appending/overwriting into a range that already contains data with allow_overwrite disabled; concurrent editors changing the sheet; sheet grid smaller than the payload; hitting API QPS limits on large payloads.","solutions":["Read the partial_success message for the exact row span that failed, then re-run the put for the remaining data.","If overwrite of existing data is intended, use overwrite mode or allow overwrite so the backend accepts the write.","Retry after a short backoff if the cause is rate limiting (429/ TooManyRequests).","Shrink the payload or ensure the sheet grid is large enough for the row range."],"exampleFix":"// before: append colliding with existing data\nlark sheet table put --token T --sheet Data --mode append --row 1,2\n// after: switch to overwrite of the intended anchor or clean the target rows first\nlark sheet table put --token T --sheet Data --mode overwrite --row 1,2","handlingStrategy":"validation","validationCode":"// ensure the target grid can accept the rows before writing:\nif mode == \"append\" && !allowOverwrite {\n\t// confirm the rows below the current last data row are empty via table get\n}","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"writing rows\") {\n\t// parse the reported row span from the partial_success message and resume from there\n}","preventionTips":["Set allow_overwrite explicitly when data collisions are possible.","Keep batch sizes modest to reduce rate-limit exposure.","Avoid concurrent writers to the same sheet range."],"tags":["sheets","write-failure","partial-success"],"backgroundTag":"cell-range-write-failed","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"}