{"record":{"id":"ea392c5d64f721ba","repo":"larksuite/cli","slug":"args-field-s-s-description-is-required-via","errorCode":null,"errorMessage":"Args field %s (--%s): description is required via doc or InputField.Description","messagePattern":"Args field (.+?) \\(--(.+?)\\): description is required via doc or InputField\\.Description","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_args.go","lineNumber":60,"sourceCode":"\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 {\n\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}","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_args.go#L42-L78","documentation":"Every compiled Args field must have a non-empty description used in --help and schema output. compileInput throws this when neither the struct field's doc comment nor an InputField.Description supplement supplied one. Descriptions are a hard requirement for generated CLI help quality.","triggerScenarios":"Defining a struct field with flag/arg tags but no doc comment, and no matching InputField.Description in definition.Fields, then compiling the definition.","commonSituations":"Adding a new flag field quickly without a comment; stripping comments with a formatter/refactor; assuming a json tag alone provides the description.","solutions":["Add a doc comment line above the struct field describing the flag.","Or set Description on the matching Input.Fields supplement.","Run the compile step (schema/help generation) again to confirm the field passes."],"exampleFix":"// before\ntype Args struct {\n  UserID string `flag:\"user-id\"`\n}\n// after\ntype Args struct {\n  // Lark user ID (open_id or user_id) to assign the task.\n  UserID string `flag:\"user-id\"`\n}","handlingStrategy":"validation","validationCode":"func allFieldsDocumented(t reflect.Type) error {\n  for i := 0; i < t.NumField(); i++ {\n    if t.Field(i).IsExported() && docOf(t.Field(i)) == \"\" {\n      return fmt.Errorf(\"field %s missing description\", t.Field(i).Name)\n    }\n  }\n  return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write a doc comment on every tagged struct field as a habit.","Or supply Description via Input.Fields for externally documented fields.","Gate CI on compiling all definitions so missing docs fail early."],"tags":["go","documentation","flags","help-output"],"backgroundTag":"missing-description-field","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"}