{"record":{"id":"a293b79e19805fc6","repo":"larksuite/cli","slug":"unknown-cli-encoding-q","errorCode":null,"errorMessage":"unknown CLI encoding %q","messagePattern":"unknown CLI encoding %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_args.go","lineNumber":339,"sourceCode":"\t\tif kind != reflect.Slice && kind != reflect.Array {\n\t\t\treturn fmt.Errorf(\"encoding comma_or_repeated requires an array or slice\")\n\t\t}\n\t\telementKind := indirectType(field.valueType).Elem().Kind()\n\t\tif elementKind != reflect.String && !isIntegerKind(elementKind) {\n\t\t\treturn fmt.Errorf(\"encoding comma_or_repeated only supports string or integer arrays\")\n\t\t}\n\t\tif field.nullable != nil {\n\t\t\treturn fmt.Errorf(\"encoding comma_or_repeated does not allow nullable/nonnullable\")\n\t\t}\n\tcase typedEncodingJSON:\n\t\tif kind != reflect.Slice && kind != reflect.Array && kind != reflect.Struct && kind != reflect.Map && kind != reflect.Interface {\n\t\t\treturn fmt.Errorf(\"encoding json requires array, object, oneOf, or custom JSON input\")\n\t\t}\n\t\tif isNilCapable(field.valueType) && field.nullable == nil && !field.shapeExplicit && !shapeExplicitlyNullable(field.shape) {\n\t\t\treturn fmt.Errorf(\"nil-capable encoding=json input must declare nullable or nonnullable\")\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown CLI encoding %q\", field.cli.Encoding)\n\t}\n\tseenAliases := make(map[string]struct{})\n\tfor i, alias := range field.cli.Aliases {\n\t\tif !aliasNamePattern.MatchString(alias.Name) {\n\t\t\treturn fmt.Errorf(\"alias[%d] name %q is invalid\", i, alias.Name)\n\t\t}\n\t\tif alias.Name == field.name {\n\t\t\treturn fmt.Errorf(\"alias[%d] duplicates canonical flag --%s\", i, field.name)\n\t\t}\n\t\tif _, duplicate := seenAliases[alias.Name]; duplicate {\n\t\t\treturn fmt.Errorf(\"duplicate alias --%s\", alias.Name)\n\t\t}\n\t\tseenAliases[alias.Name] = struct{}{}\n\t\tswitch alias.Mode {\n\t\tcase typedAliasNormalize:\n\t\t\tif alias.Conflict != \"\" {\n\t\t\t\treturn fmt.Errorf(\"normalize alias --%s cannot declare Conflict\", alias.Name)\n\t\t\t}","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_args.go#L321-L357","documentation":"Validation in validateInputCLI: the encoding name in the cli tag is not a known typed encoding. Only the registered typedEncoding values (e.g. comma_or_repeated, json) are accepted.","triggerScenarios":"A field declares cli:\"encoding=csv\", \"encoding=list\", or any misspelled/unknown encoding name (e.g. wrong casing); validateInputCLI reaches `default:` during compileInput.","commonSituations":"Typos in tag strings (tags are not compile-checked); inventing an encoding that the framework does not implement; casing mistakes like encoding=JSON.","solutions":["Correct the encoding name to one of: repeated, comma_or_repeated, json.","Remove the encoding for scalar fields that need none.","Search the codebase for typedEncoding* constants to see the exact supported set and spelling."],"exampleFix":"// before\nIDs []int64 `schema:\"optional\" cli:\"encoding=repeated-list\"`\n// after\nIDs []int64 `schema:\"optional\" cli:\"encoding=comma_or_repeated\"`","handlingStrategy":"validation","validationCode":"var validEncodings = map[string]bool{\"repeated\": true, \"comma_or_repeated\": true, \"json\": true}\nfunc encodingKnown(tagVal string) error {\n\t// tagVal like \"encoding=csv\"\n\tfor _, part := range strings.Split(tagVal, \";\") {\n\t\tif enc, ok := strings.CutPrefix(part, \"encoding=\"); ok && !validEncodings[enc] {\n\t\t\treturn fmt.Errorf(\"unknown encoding %q\", enc)\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use encoding values copied from existing working tags in this repo.","Encoding names are lowercase and snake_cased; do not invent variants.","Grep for typedEncoding constants to confirm the supported set."],"tags":["cli","schema","typo","authoring-time"],"backgroundTag":"invalid-cli-tag-encoding","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"}