Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-13461

Obscure API error message "Incorrect arguments passed to function"

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Duplicate
    • Icon: Trivial Trivial
    • None
    • 4.0.0alpha3, 5.0.14, 5.4.2, 6.0 (plan)
    • API (A)

      This happens also with other methods but this example will be about host.create.

      Trying to create a host with host interface identified by IP. Still I am forced to set an empty DNS value: "dns":"" and if I don't I get obscure error message: Incorrect arguments passed to function.

      The fact that a user sends JSON and gets error message about incorrect function usage is really annoying and the error message is not helpful at all.

      Steps to reproduce:
      Send JSON to create a host without specifying empty "dns" param:

      {"jsonrpc":"2.0","method":"host.create","params":{"host":"test host","interfaces":[{"type":1,"main":1,"useip":1,"ip":"127.0.0.1","port":"10050"}],"groups":[{"groupid":"4"}]},"auth":"a21705c51026778eafc68494b52bd9a0","id":1}

      Result:
      Check the error in returned JSON:

       {"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Incorrect arguments passed to function."},"id":1}

      Expected:
      Error message telling the real problem is missing param: "dns".
      It would be great also not to force user to set empty parameters.

            zabbix.dev Zabbix Development Team
            dimir dimir
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: