{"record":{"id":"16b3e49a70a9a999","repo":"larksuite/cli","slug":"s-got-both-q-and-range-keep-range-and-drop","errorCode":null,"errorMessage":"%s got both %q and \"range\" — keep \"range\" and drop %q","messagePattern":"(.+?) got both %q and \"range\" — keep \"range\" and drop %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/sheets/batch_op_dispatch.go","lineNumber":494,"sourceCode":"\t\t\t// before its target (\"size\" < \"width\"), so nothing has claimed the\n\t\t\t// logical key yet. Name both spellings and the survivor.\n\t\t\ttaken := target\n\t\t\tif underscoreTaken {\n\t\t\t\ttaken = underscored\n\t\t\t}\n\t\t\tif jsonEqual(input[k], input[taken]) {\n\t\t\t\tdelete(input, k) // same value under two names: drop the alias.\n\t\t\t\t// Hand the logical key over to the surviving spelling, or the\n\t\t\t\t// claim recorded above would still point at the deleted alias\n\t\t\t\t// and make that spelling's own turn read as a conflict.\n\t\t\t\tcanonical[target] = taken\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"%s got both %q and %q, which are two names for the same flag, with different values — keep %q\", sc, k, taken, taken) //nolint:forbidigo // intermediate error; the batch dispatcher wraps it into a typed operations validation error\n\t\t}\n\t\tif strings.ToLower(hv) == \"ranges\" && vocab[\"range\"] && !vocab[\"ranges\"] {\n\t\t\tif _, taken := input[\"range\"]; taken {\n\t\t\t\treturn fmt.Errorf(\"%s got both %q and \\\"range\\\" — keep \\\"range\\\" and drop %q\", sc, k, k) //nolint:forbidigo // intermediate error; the batch dispatcher wraps it into a typed operations validation error\n\t\t\t}\n\t\t\tif arr, isArr := input[k].([]interface{}); isArr {\n\t\t\t\tif len(arr) == 1 {\n\t\t\t\t\tif s, isStr := arr[0].(string); isStr {\n\t\t\t\t\t\tinput[\"range\"] = s\n\t\t\t\t\t\tdelete(input, k)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\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)","sourceCodeStart":476,"sourceCodeEnd":512,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/sheets/batch_op_dispatch.go#L476-L512","documentation":"Special case for the ranges/range pair: when the vocab has `range` but not `ranges`, a `ranges` key in the input conflicts with an existing `range` key. The dispatcher errors, telling you to keep `range` and drop the `ranges` spelling.","triggerScenarios":"Sub-op input contains both `range` and `ranges` (in any casing normalized to `ranges`) for an op whose vocabulary only accepts a single `range` field.","commonSituations":"Reusing payload shapes from ops that accept `ranges` in ops that take one `range`; older scripts written against a plural-key API version.","solutions":["Remove the `ranges` key and keep the `range` key.","If you meant multiple ranges, split them into multiple sub-ops, one per range, each with a single `range`.","Update legacy payloads that used the plural key to the singular form."],"exampleFix":"// before\n{\"range\": \"Sheet1!A1:B2\", \"ranges\": [\"Sheet1!C1:D2\"]}\n// after\n{\"range\": \"Sheet1!A1:B2\"} // plus a second sub-op for Sheet1!C1:D2","handlingStrategy":"validation","validationCode":"if r, ok := op[\"ranges\"]; ok {\n    if _, also := op[\"range\"]; also {\n        return errors.New(\"use only `range` (single value) or split into sub-ops\")\n    }\n    _ = r\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use `range` (singular) for ops whose schema declares only `range`.","For multi-range writes, emit one sub-op per range.","Migrate any payload templates that still use the plural `ranges` key."],"tags":["sheets","validation","naming-convention"],"backgroundTag":"conflicting-parameter-spelling","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"}