docker/cli ยท error

%[1]s: '%[2]s' requires %[3]d %[4]s Usage: %[5]s Run '%[2

Error message

%[1]s: '%[2]s' requires %[3]d %[4]s

Usage:  %[5]s

Run '%[2]s --help' for more information

What it means

Error "%[1]s: '%[2]s' requires %[3]d %[4]s Usage: %[5]s Run '%[2]s --help' for more information" thrown in docker/cli.

Source

Thrown at cli/required.go:91

		return fmt.Errorf(
			"%[1]s: '%[2]s' requires at least %[3]d and at most %[4]d %[5]s\n\nUsage:  %[6]s\n\nRun '%[2]s --help' for more information",
			binName(cmd),
			cmd.CommandPath(),
			minArgs,
			maxArgs,
			pluralize("argument", maxArgs),
			cmd.UseLine(),
		)
	}
}

// ExactArgs returns an error if there is not the exact number of args
func ExactArgs(number int) cobra.PositionalArgs {
	return func(cmd *cobra.Command, args []string) error {
		if len(args) == number {
			return nil
		}
		return fmt.Errorf(
			"%[1]s: '%[2]s' requires %[3]d %[4]s\n\nUsage:  %[5]s\n\nRun '%[2]s --help' for more information",
			binName(cmd),
			cmd.CommandPath(),
			number,
			pluralize("argument", number),
			cmd.UseLine(),
		)
	}
}

// binName returns the name of the binary / root command (usually 'docker').
func binName(cmd *cobra.Command) string {
	return cmd.Root().Name()
}

//nolint:unparam
func pluralize(word string, number int) string {
	if number == 1 {

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/required.go:91 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/af8170a32e63e633.json. Report an issue: GitHub.