{"record":{"id":"c0b5708876f02bb5","repo":"larksuite/cli","slug":"s-declares-flag-aliases-for-s-more-than-once-a","errorCode":null,"errorMessage":"%s declares flag aliases for --%s more than once after normalization","messagePattern":"(.+?) declares flag aliases for --(.+?) more than once after normalization","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/flagalias/flagalias.go","lineNumber":87,"sourceCode":"\tacceptedAliases := make(map[string]string)\n\tcollectAnnotatedAliases(acceptedAliases, flagSet, normalize)\n\tcollectAnnotatedAliases(acceptedAliases, cmd.InheritedFlags(), normalize)\n\n\taliases := make(map[string]string)\n\tmetadata := make(map[*pflag.Flag][]string)\n\tcanonicalFlags := make(map[string]*pflag.Flag)\n\tseenCanonical := make(map[string]struct{})\n\tfor _, spec := range specs {\n\t\tif len(spec.Aliases) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tcanonicalFlag := flagSet.Lookup(spec.Canonical)\n\t\tif canonicalFlag == nil {\n\t\t\treturn fmt.Errorf(\"%s declares aliases for unregistered flag --%s\", cmd.CommandPath(), spec.Canonical)\n\t\t}\n\t\tcanonical := canonicalFlag.Name\n\t\tif _, exists := seenCanonical[canonical]; exists {\n\t\t\treturn fmt.Errorf(\"%s declares flag aliases for --%s more than once after normalization\", cmd.CommandPath(), canonical)\n\t\t}\n\t\tseenCanonical[canonical] = struct{}{}\n\t\tcanonicalFlags[canonical] = canonicalFlag\n\t\tfor _, alias := range spec.Aliases {\n\t\t\tif err := validateAliasName(alias); err != nil {\n\t\t\t\treturn fmt.Errorf(\"%s alias for --%s: %w\", cmd.CommandPath(), canonical, err)\n\t\t\t}\n\t\t\tnormalized := normalize(alias)\n\t\t\tif normalized == \"\" {\n\t\t\t\treturn fmt.Errorf(\"%s alias --%s for --%s normalizes to an empty name\", cmd.CommandPath(), alias, canonical)\n\t\t\t}\n\t\t\tif normalized == canonical {\n\t\t\t\treturn fmt.Errorf(\"%s declares --%s as an alias of itself (--%s after normalization)\", cmd.CommandPath(), alias, canonical)\n\t\t\t}\n\t\t\tif existing, ok := registered[normalized]; ok {\n\t\t\t\treturn fmt.Errorf(\"%s alias --%s for --%s conflicts with registered flag --%s after normalization\", cmd.CommandPath(), alias, canonical, existing)\n\t\t\t}\n\t\t\tif existing, ok := acceptedAliases[normalized]; ok {","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/flagalias/flagalias.go#L69-L105","documentation":"Validation in Bind: two specs declare aliases for the same canonical flag (identical after normalization). Each canonical flag may receive aliases from only one spec, otherwise alias bookkeeping would be ambiguous.","triggerScenarios":"Thrown at internal/flagalias/flagalias.go:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Merge the aliases into a single Spec for that canonical flag"],"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"}