{"record":{"id":"d054f27e0fbe62e1","repo":"larksuite/cli","slug":"s","errorCode":null,"errorMessage":"%s","messagePattern":"%s","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/sheets/batch_op_dispatch.go","lineNumber":521,"sourceCode":"\t\t\t\t}\n\t\t\t\treturn fmt.Errorf(\"%s takes a single \\\"range\\\" per sub-op, got %d entries in %q — split them into %d sub-ops (one per range)\", sc, len(arr), k, len(arr)) //nolint:forbidigo // intermediate error; the batch dispatcher wraps it into a typed operations validation error\n\t\t\t}\n\t\t\tif s, isStr := input[k].(string); isStr {\n\t\t\t\tinput[\"range\"] = s\n\t\t\t\tdelete(input, k)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tmsg := fmt.Sprintf(\"unknown input key %q\", k)\n\t\tdisplay := make([]string, 0, len(vocab))\n\t\tfor name := range vocab {\n\t\t\tdisplay = append(display, strings.ReplaceAll(name, \"-\", \"_\"))\n\t\t}\n\t\tsort.Strings(display)\n\t\tif match := suggest.Closest(strings.ToLower(hv), display, 1); len(match) > 0 {\n\t\t\tmsg += fmt.Sprintf(\" — did you mean %q?\", match[0])\n\t\t}\n\t\treturn fmt.Errorf(\"%s\", msg) //nolint:forbidigo // intermediate error; the batch dispatcher wraps it into a typed operations validation error\n\t}\n\treturn nil\n}\n\n// translateBatchOp 把一个 CLI 视角的 {shortcut, input} 翻成底层 MCP\n// batch_update 的 {tool_name, input}。`index` 用于错误信息定位。input 用\n// shortcut 的 CLI flag 名（连字符/下划线均可），经该 shortcut 的 standalone\n// translator 翻成 MCP body。\n//\n// 失败场景：\n//   - shortcut 字段缺失 / 非 string\n//   - shortcut 不在 dispatch 表（拼写错；read 操作；嵌套 fan-out wrapper）\n//   - input 不是 object\n//   - input 里手填了 operation（由 shortcut 名隐含，禁手填以防 mismatch）\n//   - input 顶层出现 cell_styles / cell_merges / styles（误贴 MCP body 包裹结构）\n//   - 子操作的 translator 报错（如缺必填字段）\nfunc translateBatchOp(raw interface{}, token string, index int) (map[string]interface{}, error) {\n\treturn translateBatchOpWithDispatch(raw, token, index, batchOpDispatch, \"+batch-update\")","sourceCodeStart":503,"sourceCodeEnd":539,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/sheets/batch_op_dispatch.go#L503-L539","documentation":"Final rejection for an unrecognized key in a sub-op input: the dispatcher builds a message listing the valid keys and appends a `did you mean` suggestion when the closest known key is near. The raw message is emitted as-is here; the batch dispatcher wraps it into a typed operations validation error.","triggerScenarios":"A sub-op input contains a key that is not in the op's vocabulary under any accepted spelling — a typo like `valeus` instead of `values`, a field the op does not support, or a key with an unsupported naming convention.","commonSituations":"Typos in hand-written payloads; using fields from one op type in another op that lacks them; stale payloads after a vocabulary change; guessing flag names instead of checking `schema`.","solutions":["Apply the `did you mean` suggestion from the message (e.g. rename `valeus` to `values`).","Run `lark-cli schema` for the shortcut to list the exact accepted fields for the op.","Remove fields the target op does not support, or move them to a sub-op that accepts them."],"exampleFix":"// before\n{\"op\": \"set\", \"range\": \"A1:B2\", \"valeus\": [[\"x\"]]}\n// error: did you mean \"values\"?\n// after\n{\"op\": \"set\", \"range\": \"A1:B2\", \"values\": [[\"x\"]]}","handlingStrategy":"validation","validationCode":"var validKeys = map[string]bool{\"op\": true, \"range\": true, \"values\": true, \"cell_range\": true}\nfor k := range subOp {\n    if !validKeys[strings.ReplaceAll(k, \"-\", \"_\")] {\n        return fmt.Errorf(\"unknown key %q\", k)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check `lark-cli schema` for the exact field names each op accepts.","Build payloads from typed structs, not hand-written maps, so typos fail at compile time.","Spell-check key names against the vocabulary; heed `did you mean` hints in earlier runs."],"tags":["sheets","validation","unknown-field"],"backgroundTag":"unknown-parameter","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"}