Help Center/ Koo Command Line Interface/ FAQs/ Parameters/ Why Am I Seeing a Message Indicating a Duplicate Parameter?
Updated on 2023-10-16 GMT+08:00

Why Am I Seeing a Message Indicating a Duplicate Parameter?

Background

KooCLI checks the validity of parameters during command execution. If a command contains duplicate parameters, different error messages will be displayed accordingly. For example:

  1. [USE_ERROR] Duplicate parameter: *
  2. [USE_ERROR] Duplicate *. Change the key of the KooCLI system parameter to cli-*.
  3. [USE_ERROR] Duplicate *. Enter the API parameter using '--cli-jsonInput=xx'. For details, see...

Among the KooCLI system parameters, some have two forms, for example, --region and --cli-region. This happens because some parameters of cloud service APIs may have the same names as system parameters.

Solution

  1. If the first error message is displayed, duplicate non-system parameters may exist in the command. Check whether the parameters are entered correctly. This error may also occur when the system parses the command content. If the parameter value contains special characters, enclose the value with double quotation marks ("") to prevent parsing errors.
  2. If the second error message is displayed, a duplicate old system parameter exists in the command. Run the hcloud <service> <operation> --help command and compare the value of Params in the command output (that is, the parameter list of the current API) to check whether the parameter exists in the target API or whether a parameter with a custom name (that is, the parameter whose name is {*}) exists. If not, check whether the input is correct. If yes, use the two parameters with the same name for different purposes, one as a parameter of the target API, and the other as a system parameter. Replace the old system parameter in the command with the new one as prompted. If a command contains both the old and new forms of a system parameter, for example, --cli-region=${regionValue1} --region=${regionValue2}, KooCLI automatically identifies the usage of each parameter based on the parameter list of the current API.
    • If the target API has the region parameter or a parameter with a custom name, KooCLI automatically identifies --cli-region as a system parameter and uses its value to obtain details about the target API. KooCLI identifies --region as a parameter of the target API and uses its value to call the API.
    • If the target API does not have the region parameter or a parameter with a custom name, KooCLI automatically identifies --cli-region as a system parameter and uses its value to obtain details about the target API. KooCLI ignores --region passed to the command.

    When you construct KooCLI commands, use the new system parameters to prevent errors or interactions caused by parameter conflicts.

  3. If the third error message is displayed, a duplicate new system parameter exists in the command. Run the hcloud <service> <operation> --help command and compare the value of Params in the command output (that is, the parameter list of the current API) to check whether the parameter exists in the target API or whether a parameter with a custom name (that is, the parameter whose name is {*}) exists. If not, check whether the input is correct. If yes (this conflict rarely occurs), write the API parameters in the command into the cli-jsonInput file and call the command using this JSON file.