larksuite/cli · error
%s declares --%s as an alias of itself (--%s after normaliza
Error message
%s declares --%s as an alias of itself (--%s after normalization)
What it means
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.
Source
Thrown at internal/flagalias/flagalias.go:100
if canonicalFlag == nil {
return fmt.Errorf("%s declares aliases for unregistered flag --%s", cmd.CommandPath(), spec.Canonical)
}
canonical := canonicalFlag.Name
if _, exists := seenCanonical[canonical]; exists {
return fmt.Errorf("%s declares flag aliases for --%s more than once after normalization", cmd.CommandPath(), canonical)
}
seenCanonical[canonical] = struct{}{}
canonicalFlags[canonical] = canonicalFlag
for _, alias := range spec.Aliases {
if err := validateAliasName(alias); err != nil {
return fmt.Errorf("%s alias for --%s: %w", cmd.CommandPath(), canonical, err)
}
normalized := normalize(alias)
if normalized == "" {
return fmt.Errorf("%s alias --%s for --%s normalizes to an empty name", cmd.CommandPath(), alias, canonical)
}
if normalized == canonical {
return fmt.Errorf("%s declares --%s as an alias of itself (--%s after normalization)", cmd.CommandPath(), alias, canonical)
}
if existing, ok := registered[normalized]; ok {
return fmt.Errorf("%s alias --%s for --%s conflicts with registered flag --%s after normalization", cmd.CommandPath(), alias, canonical, existing)
}
if existing, ok := acceptedAliases[normalized]; ok {
return fmt.Errorf("%s alias --%s for --%s conflicts with existing alias for --%s after normalization to --%s", cmd.CommandPath(), alias, canonical, existing, normalized)
}
if existing, ok := aliases[normalized]; ok {
if existing == canonical {
return fmt.Errorf("%s declares duplicate alias --%s for --%s after normalization to --%s", cmd.CommandPath(), alias, canonical, normalized)
}
return fmt.Errorf("%s alias --%s maps to both --%s and --%s after normalization to --%s", cmd.CommandPath(), alias, existing, canonical, normalized)
}
aliases[normalized] = canonical
metadata[canonicalFlag] = append(metadata[canonicalFlag], alias)
}
}
View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Remove the redundant alias that equals its canonical flag
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/flagalias/flagalias.go:100 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/b608597a8c1ea4c2.
Report an issue: GitHub.