{"record":{"id":"b608597a8c1ea4c2","repo":"larksuite/cli","slug":"s-declares-s-as-an-alias-of-itself-s-after","errorCode":null,"errorMessage":"%s declares --%s as an alias of itself (--%s after normalization)","messagePattern":"(.+?) declares --(.+?) as an alias of itself \\(--(.+?) after normalization\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/flagalias/flagalias.go","lineNumber":100,"sourceCode":"\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 {\n\t\t\t\treturn fmt.Errorf(\"%s alias --%s for --%s conflicts with existing alias for --%s after normalization to --%s\", cmd.CommandPath(), alias, canonical, existing, normalized)\n\t\t\t}\n\t\t\tif existing, ok := aliases[normalized]; ok {\n\t\t\t\tif existing == canonical {\n\t\t\t\t\treturn fmt.Errorf(\"%s declares duplicate alias --%s for --%s after normalization to --%s\", cmd.CommandPath(), alias, canonical, normalized)\n\t\t\t\t}\n\t\t\t\treturn fmt.Errorf(\"%s alias --%s maps to both --%s and --%s after normalization to --%s\", cmd.CommandPath(), alias, existing, canonical, normalized)\n\t\t\t}\n\t\t\taliases[normalized] = canonical\n\t\t\tmetadata[canonicalFlag] = append(metadata[canonicalFlag], alias)\n\t\t}\n\t}\n","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/flagalias/flagalias.go#L82-L118","documentation":"Validation in Bind: a spec lists a flag as an alias of itself (alias equals the canonical name after normalization). Self-aliasing is redundant and rejected to keep the alias map meaningful.","triggerScenarios":"Thrown at internal/flagalias/flagalias.go:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the redundant alias that equals its 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"}