{"record":{"id":"0a1ed0b3947deba3","repo":"larksuite/cli","slug":"args-field-s-s-w","errorCode":null,"errorMessage":"Args field %s (--%s): %w","messagePattern":"Args field (.+?) \\(--(.+?)\\): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_args.go","lineNumber":55,"sourceCode":"\t}\n\tvar fields []compiledInputField\n\tseenGo := make(map[string]struct{})\n\tif err := collectArgFields(argsType, nil, false, &fields, seenGo, supplements); err != nil {\n\t\treturn nil, nil, err\n\t}\n\tfieldByName := make(map[string]int, len(fields))\n\tallNames := make(map[string]string, len(fields))\n\tfor i := range fields {\n\t\tfield := &fields[i]\n\t\tif previous, exists := allNames[field.name]; exists {\n\t\t\treturn nil, nil, fmt.Errorf(\"Args field %s flag --%s duplicates %s\", field.goName, field.name, previous)\n\t\t}\n\t\tallNames[field.name] = \"--\" + field.name\n\t\tfieldByName[field.name] = i\n\t\tsupplement, hasSupplement := supplements[field.name]\n\t\tif hasSupplement {\n\t\t\tif err := mergeInputSupplement(field, supplement); err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"Args field %s (--%s): %w\", field.goName, field.name, err)\n\t\t\t}\n\t\t\tdelete(supplements, field.name)\n\t\t}\n\t\tif field.description == \"\" {\n\t\t\treturn nil, nil, fmt.Errorf(\"Args field %s (--%s): description is required via doc or InputField.Description\", field.goName, field.name)\n\t\t}\n\t\tif err := validateInputCLI(field); err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"Args field %s (--%s): %w\", field.goName, field.name, err)\n\t\t}\n\t\tfor _, alias := range field.cli.Aliases {\n\t\t\tif previous, exists := allNames[alias.Name]; exists {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"Args field %s (--%s): alias --%s duplicates %s\", field.goName, field.name, alias.Name, previous)\n\t\t\t}\n\t\t\tallNames[alias.Name] = \"alias of --\" + field.name\n\t\t}\n\t}\n\tif len(supplements) > 0 {\n\t\tfor name := range supplements {","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_args.go#L37-L73","documentation":"This wraps any error returned by mergeInputSupplement when an Input.Fields supplement is merged onto a matching compiled Args field. The wrapper adds context identifying the offending Args field and its flag; the underlying %w cause (from mergeInputSupplement) describes the concrete problem, such as an invalid CLI option or conflicting supplement metadata.","triggerScenarios":"Providing a typedInputField supplement in definition.Fields whose CLI metadata (aliases, defaults, hidden, etc.) fails mergeInputSupplement's validation for the struct field it targets, during compileInput.","commonSituations":"Supplement declaring an invalid alias format; supplement trying to change immutable field attributes; typo'd supplement values after refactoring the struct field.","solutions":["Read the wrapped cause (%w) after this prefix to find the specific supplement problem.","Fix the supplement's CLI/metadata to satisfy mergeInputSupplement validation.","Remove the supplement if the struct field's own tags already express the desired metadata."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"err := compileDefinition(def)\nif err != nil {\n  var typed *errs.Typed\n  if errors.As(err, &typed) {\n    log.Printf(\"field-level failure: %s (cause: %v)\", typed.Message, errors.Unwrap(err))\n  }\n}","typeGuard":null,"tryCatchPattern":"if err := compileDefinition(def); err != nil {\n  cause := errors.Unwrap(err)\n  return fmt.Errorf(\"supplement merge failed: %w\", cause)\n}","preventionTips":["Only supply supplement metadata that mergeInputSupplement permits.","Match supplement names exactly to struct field flags.","After refactoring a field, re-verify its supplements compile."],"tags":["go","flags","validation","error-wrapping"],"backgroundTag":"input-field-validation-failed","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"}