{"record":{"id":"9b800596f578738c","repo":"larksuite/cli","slug":"cli-hidden-is-declared-twice","errorCode":null,"errorMessage":"CLI.Hidden is declared twice","messagePattern":"CLI\\.Hidden is declared twice","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_args.go","lineNumber":256,"sourceCode":"\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\")\n\t\t}\n\t\tfield.cli.Hidden = true\n\t}\n\tif supplement.CLI.Deprecated != \"\" {\n\t\tif field.cli.Deprecated != \"\" {\n\t\t\treturn fmt.Errorf(\"CLI.Deprecated is declared twice\")\n\t\t}\n\t\tfield.cli.Deprecated = supplement.CLI.Deprecated\n\t}\n\treturn nil\n}\n\nfunc validateInputCLI(field *compiledInputField) error {\n\tif field.cli.Deprecated != \"\" && !field.cli.Hidden {\n\t\treturn fmt.Errorf(\"deprecated primary flag must be hidden\")\n\t}\n\tif field.required && field.defaultValue.Set {\n\t\treturn fmt.Errorf(\"required input cannot declare a default\")","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_args.go#L238-L274","documentation":"Hidden was requested twice for one flag: the cli tag already marks the field hidden and InputField.CLI.Hidden is also true. Unlike value fields there is no meaningful merge for a boolean, so the compiler rejects the redundancy.","triggerScenarios":"compileInput -> mergeInputSupplement when supplement.CLI.Hidden is true and field.cli.Hidden (from cli:\"hidden\") is already true.","commonSituations":"Setting InputField.CLI.Hidden = true on a field whose tag is cli:\"hidden\", e.g. when generating supplements from a spec that also round-trips tags.","solutions":["Remove hidden from the cli tag, or set InputField.CLI.Hidden = false / omit it.","Keep exactly one hidden declaration per flag."],"exampleFix":"// before\nToken string `flag:\"token\" cli:\"hidden\"` + InputField{CLI: CLI{Hidden: true}}\n// after\nToken string `flag:\"token\"` + InputField{CLI: CLI{Hidden: true}}","handlingStrategy":"validation","validationCode":"for _, f := range fields {\n    if f.TagHidden && f.InputHidden {\n        return fmt.Errorf(\"flag %s: hidden declared twice\", f.Name)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Mark a flag hidden in exactly one place; avoid setting InputField.CLI.Hidden for fields already tagged cli:\"hidden\".","Audit generated supplements so they do not restate tag booleans."],"tags":["cli","typed-input","duplicate-declaration","hidden"],"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"}