{"record":{"id":"f52af7a4efd34839","repo":"larksuite/cli","slug":"s-got-conflicting-values-for-q-under-two-spellin","errorCode":null,"errorMessage":"%s got conflicting values for %q under two spellings (%q and %q) — keep one","messagePattern":"(.+?) got conflicting values for %q under two spellings \\(%q and %q\\) — keep one","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/sheets/batch_op_dispatch.go","lineNumber":422,"sourceCode":"\t}\n\tkeys := make([]string, 0, len(input))\n\tfor k := range input {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\taliases := commandFlagAliases[sc]\n\t// canonical tracks which raw key already claimed each logical key, so two\n\t// spellings of the same flag (sheet-id / sheet_id / sheetId) can never both\n\t// survive into the tool body — the flag view resolves hyphen↔underscore\n\t// variants, so a leftover duplicate would be silently shadowed and could\n\t// send the write to the wrong sheet.\n\tcanonical := map[string]string{}\n\tclaim := func(logical, raw string) error {\n\t\tif prev, taken := canonical[logical]; taken {\n\t\t\tif jsonEqual(input[prev], input[raw]) {\n\t\t\t\treturn nil // same value under two spellings: harmless\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"%s got conflicting values for %q under two spellings (%q and %q) — keep one\", sc, strings.ReplaceAll(logical, \"-\", \"_\"), prev, raw) //nolint:forbidigo // intermediate error; the batch dispatcher wraps it into a typed operations validation error\n\t\t}\n\t\tcanonical[logical] = raw\n\t\treturn nil\n\t}\n\tfor _, k := range keys {\n\t\thv := strings.ReplaceAll(k, \"_\", \"-\")\n\t\tif vocab[hv] {\n\t\t\tif err := claim(hv, k); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// Normalize the surviving spelling to the underscore form the tool\n\t\t\t// bodies use, so exactly one key reaches the flag view.\n\t\t\tif target := strings.ReplaceAll(hv, \"-\", \"_\"); target != k {\n\t\t\t\tif _, taken := input[target]; !taken {\n\t\t\t\t\tinput[target] = input[k]\n\t\t\t\t\tdelete(input, k)\n\t\t\t\t\tcanonical[hv] = target\n\t\t\t\t}","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/sheets/batch_op_dispatch.go#L404-L440","documentation":"The sheets batch op dispatcher normalizes key spellings (snake_case vs kebab-case) for sub-op inputs. When the same logical key is claimed under two spellings and the values differ, it refuses to silently pick one and reports a conflict, telling you to keep a single spelling.","triggerScenarios":"A batch operation sub-op input JSON contains both spellings of the same logical field, e.g. `cell_range` and `cell-range`, with different values. If the values are identical it passes; only genuinely conflicting values trigger this.","commonSituations":"Copy-pasting payload examples from older docs that used kebab-case into scripts using snake_case; merging two partial payloads that each set the field once; tool-generated JSON mixing naming conventions.","solutions":["Remove one of the two spellings from the sub-op input, keeping the value you intend.","Make the values identical if both spellings were meant to convey the same setting.","Standardize on snake_case keys in your payload, matching the canonical target naming."],"exampleFix":"// before\n{\"cell_range\": \"A1:B2\", \"cell-range\": \"C3:D4\"}\n// after\n{\"cell_range\": \"A1:B2\"}","handlingStrategy":"validation","validationCode":"func dedupeSpellings(op map[string]interface{}) error {\n    norm := map[string]interface{}{}\n    for k, v := range op {\n        n := strings.ReplaceAll(strings.ReplaceAll(k, \"_\", \"-\"), \"-\", \"_\")\n        if prev, ok := norm[n]; ok && !reflect.DeepEqual(prev, v) {\n            return fmt.Errorf(\"conflicting values for %q\", n)\n        }\n        norm[n] = v\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Emit sub-op keys in snake_case only.","Never merge payloads from two different naming-convention sources without normalizing keys first.","Add a payload lint step that rejects duplicate logical keys."],"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"}