{"record":{"id":"0122212f429a4bb2","repo":"larksuite/cli","slug":"args-field-s-must-declare-exactly-one-of-flag-or","errorCode":null,"errorMessage":"Args field %s must declare exactly one of flag or arg","messagePattern":"Args field (.+?) must declare exactly one of flag or arg","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_args.go","lineNumber":92,"sourceCode":"\t\t\treturn nil, nil, fmt.Errorf(\"Input.Fields references unknown flag --%s\", name)\n\t\t}\n\t}\n\treturn fields, fieldByName, nil\n}\n\nfunc collectArgFields(t reflect.Type, parentIndex []int, insideInline bool, out *[]compiledInputField, seenGo map[string]struct{}, supplements map[string]typedInputField) error {\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tfield := t.Field(i)\n\t\tif !field.IsExported() {\n\t\t\tif hasAnyTag(field, \"flag\", \"arg\", \"schema\", \"cli\", \"doc\", \"json\") {\n\t\t\t\treturn fmt.Errorf(\"Args field %s is unexported but declares Typed input tags\", field.Name)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tflagName, hasFlag := field.Tag.Lookup(\"flag\")\n\t\targMode, hasArg := field.Tag.Lookup(\"arg\")\n\t\tif hasFlag == hasArg {\n\t\t\treturn fmt.Errorf(\"Args field %s must declare exactly one of flag or arg\", field.Name)\n\t\t}\n\t\tif _, duplicate := seenGo[field.Name]; duplicate {\n\t\t\treturn fmt.Errorf(\"Args field %s is duplicated through inline expansion\", field.Name)\n\t\t}\n\t\tseenGo[field.Name] = struct{}{}\n\t\tindex := append(append([]int(nil), parentIndex...), i)\n\t\tif hasArg {\n\t\t\tswitch argMode {\n\t\t\tcase \"local\":\n\t\t\t\tif insideInline {\n\t\t\t\t\treturn fmt.Errorf(\"Args field %s: arg:\\\"local\\\" is not allowed inside inline\", field.Name)\n\t\t\t\t}\n\t\t\t\tif hasAnyTag(field, \"flag\", \"schema\", \"cli\", \"doc\", \"json\") {\n\t\t\t\t\treturn fmt.Errorf(\"Args field %s: arg:\\\"local\\\" cannot declare public input tags\", field.Name)\n\t\t\t\t}\n\t\t\tcase \"inline\":\n\t\t\t\tif insideInline {\n\t\t\t\t\treturn fmt.Errorf(\"Args field %s: nested arg:\\\"inline\\\" is not allowed\", field.Name)","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_args.go#L74-L110","documentation":"collectArgFields compile-time contract: an exported Args struct field carries both `flag` and `arg` tags (or neither) - hasFlag == hasArg - so the reflection compiler cannot decide the input kind. Fires during compileInput, not at runtime from user input.","triggerScenarios":"Thrown at shortcuts/common/typed_compile_args.go:92 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Give the field exactly one of the `flag` or `arg` struct tags"],"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"}