larksuite/cli · error

Args field %s: arg:"local" cannot declare public input tags

Error message

Args field %s: arg:"local" cannot declare public input tags

What it means

Compile-time guard: a field with arg:"local" also declares public input tags (flag/schema/cli/doc/json), which is contradictory since local args are never surfaced as public input.

Source

Thrown at shortcuts/common/typed_compile_args.go:106

		}
		flagName, hasFlag := field.Tag.Lookup("flag")
		argMode, hasArg := field.Tag.Lookup("arg")
		if hasFlag == hasArg {
			return fmt.Errorf("Args field %s must declare exactly one of flag or arg", field.Name)
		}
		if _, duplicate := seenGo[field.Name]; duplicate {
			return fmt.Errorf("Args field %s is duplicated through inline expansion", field.Name)
		}
		seenGo[field.Name] = struct{}{}
		index := append(append([]int(nil), parentIndex...), i)
		if hasArg {
			switch argMode {
			case "local":
				if insideInline {
					return fmt.Errorf("Args field %s: arg:\"local\" is not allowed inside inline", field.Name)
				}
				if hasAnyTag(field, "flag", "schema", "cli", "doc", "json") {
					return fmt.Errorf("Args field %s: arg:\"local\" cannot declare public input tags", field.Name)
				}
			case "inline":
				if insideInline {
					return fmt.Errorf("Args field %s: nested arg:\"inline\" is not allowed", field.Name)
				}
				inlineType := field.Type
				if inlineType.Kind() == reflect.Pointer {
					return fmt.Errorf("Args field %s: arg:\"inline\" must be a struct value, not pointer", field.Name)
				}
				if inlineType.Kind() != reflect.Struct {
					return fmt.Errorf("Args field %s: arg:\"inline\" must be a struct, got %s", field.Name, field.Type)
				}
				if hasAnyTag(field, "flag", "schema", "cli", "doc", "json") {
					return fmt.Errorf("Args field %s: arg:\"inline\" cannot declare public input tags", field.Name)
				}
				if err := collectArgFields(inlineType, index, true, out, seenGo, supplements); err != nil {
					return err
				}

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Remove the public tags from the local field, or drop arg:"local"
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shortcuts/common/typed_compile_args.go:106 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/201134a7944c870a. Report an issue: GitHub.