{"record":{"id":"e52c04ecfd6d2c0d","repo":"larksuite/cli","slug":"cli-aliases-is-declared-by-both-cli-tag-and-inputf","errorCode":null,"errorMessage":"CLI.Aliases is declared by both cli tag and InputField.CLI","messagePattern":"CLI\\.Aliases is declared by both cli tag and InputField\\.CLI","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_args.go","lineNumber":238,"sourceCode":"\t\t}\n\t\tif !shapeCompatibleWithType(shape, field.valueType) {\n\t\t\treturn fmt.Errorf(\"InputField.Shape %T is incompatible with Go type %s\", supplement.Shape, field.valueType)\n\t\t}\n\t\tfield.shape = shape\n\t\tfield.shapeExplicit = true\n\t}\n\tif supplement.Default.Set {\n\t\tif field.defaultValue.Set {\n\t\t\treturn fmt.Errorf(\"default is declared by both schema and InputField.Default\")\n\t\t}\n\t\tif field.required {\n\t\t\treturn fmt.Errorf(\"required input cannot declare a default\")\n\t\t}\n\t\tfield.defaultValue = supplement.Default\n\t}\n\tif len(supplement.CLI.Aliases) > 0 {\n\t\tif len(field.cli.Aliases) > 0 {\n\t\t\treturn fmt.Errorf(\"CLI.Aliases is declared by both cli tag and InputField.CLI\")\n\t\t}\n\t\tfield.cli.Aliases = append([]typedFlagAlias(nil), supplement.CLI.Aliases...)\n\t}\n\tif len(supplement.CLI.ValueSources) > 0 {\n\t\tif len(field.cli.ValueSources) > 0 {\n\t\t\treturn fmt.Errorf(\"CLI.ValueSources is declared by both cli tag and InputField.CLI\")\n\t\t}\n\t\tfield.cli.ValueSources = append([]typedValueSource(nil), supplement.CLI.ValueSources...)\n\t}\n\tif supplement.CLI.Encoding != \"\" {\n\t\tif field.cli.Encoding != \"\" {\n\t\t\treturn fmt.Errorf(\"CLI.Encoding is declared by both cli tag and InputField.CLI\")\n\t\t}\n\t\tfield.cli.Encoding = supplement.CLI.Encoding\n\t}\n\tif supplement.CLI.Hidden {\n\t\tif field.cli.Hidden {\n\t\t\treturn fmt.Errorf(\"CLI.Hidden is declared twice\")","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_args.go#L220-L256","documentation":"Flag aliases were declared both in the struct field's cli tag (cli:\"aliases=...\") and in InputField.CLI.Aliases. The merge step forbids double declaration to keep a single source of truth for the alias list.","triggerScenarios":"compileInput -> mergeInputSupplement when len(supplement.CLI.Aliases) > 0 and len(field.cli.Aliases) > 0 (aliases parsed from the cli tag).","commonSituations":"Migrating tag-based configuration to programmatic InputField supplements while leaving the old cli tag aliases in place.","solutions":["Remove the aliases= entry from the cli tag, keeping only InputField.CLI.Aliases.","Or delete InputField.CLI.Aliases if the tag is the canonical declaration."],"exampleFix":"// before\nName string `flag:\"name\" cli:\"aliases=n\"` + InputField{CLI: CLI{Aliases: [...]}}\n// after\nName string `flag:\"name\"` + InputField{CLI: CLI{Aliases: [...]}}","handlingStrategy":"validation","validationCode":"for _, f := range fields {\n    if len(f.TagAliases) > 0 && len(f.InputAliases) > 0 {\n        return fmt.Errorf(\"flag %s: aliases declared twice\", f.Name)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Complete tag-to-InputField migrations in one pass; delete old tag entries immediately.","Keep a checklist mapping each cli tag option to its InputField.CLI counterpart.","Cover each flag with a compile smoke test in unit tests."],"tags":["cli","typed-input","duplicate-declaration","aliases"],"backgroundTag":"conflicting-declaration","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"}