{"record":{"id":"ead9b9d2c33998f2","repo":"larksuite/cli","slug":"alias-s-has-invalid-mode-q","errorCode":null,"errorMessage":"alias --%s has invalid Mode %q","messagePattern":"alias --(.+?) has invalid Mode %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_args.go","lineNumber":372,"sourceCode":"\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}\n\t\t\tif alias.Deprecated {\n\t\t\t\treturn fmt.Errorf(\"deprecated alias --%s must use independent mode so Cobra can emit its warning\", alias.Name)\n\t\t\t}\n\t\tcase typedAliasIndependent:\n\t\t\tswitch alias.Conflict {\n\t\t\tcase typedAliasCanonicalWins, typedAliasErrorIfBoth:\n\t\t\tcase typedAliasTrimmedEqualOrError:\n\t\t\t\tif indirectKind(field.valueType) != reflect.String {\n\t\t\t\t\treturn fmt.Errorf(\"trimmed_equal_or_error alias --%s requires string input\", alias.Name)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"independent alias --%s must declare a supported Conflict\", alias.Name)\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"alias --%s has invalid Mode %q\", alias.Name, alias.Mode)\n\t\t}\n\t}\n\treturn nil\n}\n\ntype schemaTag struct {\n\trequired     bool\n\toptional     bool\n\tnullable     *bool\n\tdefaultValue typedInputDefault\n\tenum         []string\n\tformat       string\n\tminLength    *int\n\tmaxLength    *int\n\tminimum      *float64\n\tmaximum      *float64\n\tminItems     *int\n\tmaxItems     *int","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_args.go#L354-L390","documentation":"Thrown by validateInputCLI when an alias declares a Mode that is neither normalize nor independent. Alias mode is an enum; any other value makes the tag grammar invalid and the struct fails to compile into a CLI argument parser.","triggerScenarios":"A tag like `alias:--old;mode=fold` or a typo such as `mode=normalized`; compileInput -> validateInputCLI's default branch formats the invalid Mode value into the message.","commonSituations":"Typos in the mode keyword; guessing mode names instead of using the documented enum; edits after renaming mode constants.","solutions":["Set mode=normalize or mode=independent","Fix the spelling of the mode keyword","Check the alias tag grammar in the package docs/tests for valid values"],"exampleFix":"// before\nName string `cli:\"--name,alias:--nom;mode=replace;conflict=canonical-wins\"`\n// after\nName string `cli:\"--name,alias:--nom;mode=independent;conflict=canonical-wins\"`","handlingStrategy":"validation","validationCode":"var validModes = map[string]bool{\"normalize\": true, \"independent\": true}\nif !validModes[a.Mode] {\n    return fmt.Errorf(\"alias --%s: mode %q invalid\", a.Name, a.Mode)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use named constants for modes instead of string literals in tags","Grep tags for `mode=` during review and validate against the enum","Centralize alias tag construction in helpers"],"tags":["cli","flags","alias","validation"],"backgroundTag":"invalid-flag-alias-configuration","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"}