{"record":{"id":"059f98ca4fbdae2b","repo":"larksuite/cli","slug":"expected-pure-digits-row-number-or-letters-colu","errorCode":null,"errorMessage":"expected pure digits (row number) or letters (column letter), got %q","messagePattern":"expected pure digits \\(row number\\) or letters \\(column letter\\), got %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/sheets/lark_sheet_sheet_structure.go","lineNumber":872,"sourceCode":"\tfor _, r := range s {\n\t\tif r < '0' || r > '9' {\n\t\t\tisDigits = false\n\t\t}\n\t\tif !((r >= 'A' && r <= 'Z') || (r >= 'a' && r <= 'z')) {\n\t\t\tisLetters = false\n\t\t}\n\t}\n\tif isDigits {\n\t\tn, _ := strconv.Atoi(s)\n\t\tif n <= 0 {\n\t\t\treturn \"\", 0, fmt.Errorf(\"row number must be >= 1 (got %q)\", s) //nolint:forbidigo // intermediate error; callers wrap it into a typed flag validation error\n\t\t}\n\t\treturn \"row\", n - 1, nil\n\t}\n\tif isLetters {\n\t\treturn \"column\", letterToColumnIndex(s), nil\n\t}\n\treturn \"\", 0, fmt.Errorf(\"expected pure digits (row number) or letters (column letter), got %q\", s) //nolint:forbidigo // intermediate error; callers wrap it into a typed flag validation error\n}\n\n// columnIndexToLetter converts a 0-based column index to the spreadsheet\n// letter notation (0 → \"A\", 25 → \"Z\", 26 → \"AA\", 701 → \"ZZ\", 702 → \"AAA\").\n// Used by +workbook helpers that need to format absolute column references.\nfunc columnIndexToLetter(idx int) string {\n\tif idx < 0 {\n\t\treturn \"\"\n\t}\n\tidx++\n\tvar out []byte\n\tfor idx > 0 {\n\t\tidx--\n\t\tout = append([]byte{byte('A' + idx%26)}, out...)\n\t\tidx /= 26\n\t}\n\treturn string(out)\n}","sourceCodeStart":854,"sourceCodeEnd":890,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/sheets/lark_sheet_sheet_structure.go#L854-L890","documentation":"parseA1Position parses a single A1-notation token (like \"3\" for row 3 or \"B\" for column B) into a dimension type plus 0-based index. This error is thrown when the token is neither pure digits nor pure letters, e.g. \"B3\", \"\", or \"1A\" — those belong to full A1 ranges, not single-position input. Callers wrap it into a typed flag validation error.","triggerScenarios":"Passing a cell reference like \"B3\" or \"A1\" to a dimension flag that expects only a row number or only a column letter; passing an empty or whitespace/mixed token (e.g. \"1A\", \"3.5\", \"C;\") to sheet dim insert/move/before flags.","commonSituations":"Users habitually paste full cell references (B3) where the flag wants just the row number (3) or column letter (B); typos with stray characters; shell quoting introducing extra chars.","solutions":["Strip the cell reference to the single part needed: for rows pass only digits (\"3\"), for columns only letters (\"B\")","If you mean a range, use the range-accepting flag/notation (A1:B3) instead of a position flag","Trim whitespace and re-check the token for stray characters before invoking the command"],"exampleFix":"// before\nlark sheet dim-insert --position B3 ...\n// after\nlark sheet dim-insert --position 3 ...   # row index\nlark sheet dim-insert --position B ...   # column letter","handlingStrategy":"validation","validationCode":"function isValidA1Position(s) { return /^[0-9]+$/.test(s) || /^[A-Za-z]+$/.test(s); }\nif (!isValidA1Position(pos)) throw new Error(`--position must be digits (row) or letters (column), got ${pos}`);","typeGuard":"function isA1Position(v) { return typeof v === 'string' && (/^[0-9]+$/.test(v) || /^[A-Za-z]+$/.test(v)); }","tryCatchPattern":"try {\n  await run(['lark','sheet','dim-insert','--position',pos]);\n} catch (e) {\n  if (/expected pure digits/.test(e.message)) {\n    throw new Error(`Fix --position '${pos}': use digits for rows or letters for columns`);\n  }\n  throw e;\n}","preventionTips":["Pass only the row number or only the column letter to position flags, never a full cell reference like B3","Trim/validate A1 tokens before building the command line","Use range flags (A1:B3) when you actually mean a range"],"tags":["cli","validation","a1-notation","sheets"],"backgroundTag":"invalid-flag-value","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"}