{"record":{"id":"3a4c2eea1a66de75","repo":"larksuite/cli","slug":"s-must-be-a-string-got-s","errorCode":null,"errorMessage":"--%s must be a string, got %s","messagePattern":"--(.+?) must be a string, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/sheets/flag_view.go","lineNumber":345,"sourceCode":"\tdefs, err := loadFlagDefs()\n\tif err != nil {\n\t\treturn nil //nolint:nilerr // match validateRawTypes: missing embedded metadata must not block the batch\n\t}\n\tspec, ok := defs[m.command]\n\tif !ok {\n\t\treturn nil\n\t}\n\tfor _, df := range spec.Flags {\n\t\tif df.Kind == \"system\" || df.Type != \"string\" || len(df.Enum) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\trawKey, raw, changed := m.lookupRawWithKey(df.Name)\n\t\tif !changed {\n\t\t\tcontinue\n\t\t}\n\t\tvalue, ok := raw.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"--%s must be a string, got %s\", df.Name, jsonTypeName(raw)) //nolint:forbidigo // intermediate error; batch dispatcher adds typed operations context\n\t\t}\n\t\tif value == \"\" || slices.Contains(df.Enum, value) {\n\t\t\tcontinue\n\t\t}\n\t\tif canonical := canonicalEnumValue(value, df.Enum); canonical != \"\" {\n\t\t\tm.raw[rawKey] = canonical\n\t\t\tcontinue\n\t\t}\n\t\t// A retired value means \"as if omitted\" — delete the key so Changed()\n\t\t// also reports it as absent, matching the standalone path.\n\t\tif isRetiredEnumValue(m.command, df.Name, value) {\n\t\t\tdelete(m.raw, rawKey)\n\t\t\tcontinue\n\t\t}\n\t\tmessage := fmt.Sprintf(\"invalid value %q for --%s, allowed: %s\", value, df.Name, strings.Join(df.Enum, \", \"))\n\t\tif match := closestEnumValue(value, df.Enum); match != \"\" {\n\t\t\tmessage += fmt.Sprintf(\"; did you mean %q?\", match)\n\t\t}","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/sheets/flag_view.go#L327-L363","documentation":"Guard in normalizeAndValidateEnums: a batch-op raw value for a string enum flag is not a JSON string; typed enumeration validation requires string input. Intermediate error wrapped by the batch dispatcher.","triggerScenarios":"Thrown at shortcuts/sheets/flag_view.go:345 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the value as a JSON string"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}