cli icon indicating copy to clipboard operation
cli copied to clipboard

Improve invalid input error handling and printing

Open jooola opened this issue 7 months ago • 0 comments

TL;DR

We currently print the invalid input errors the same way we print all other errors.

The invalid input error holds additional details about the reasons why the invalid input error occurred, this data is not shown to the users.

$ hcloud server create --name "a a" --image debian-12 --type cpx11
hcloud: invalid input in field 'name' (invalid_input, 6ea253683232ea88)

Expected behavior

Handle invalid input errors and print all the details for the users to fully understand why the invalid input error failed. Below is an example of invalid input error with the details:

{
  "error": {
    "message": "invalid input in field 'name'",
    "code": "invalid_input",
    "details": {
      "fields": [
        {
          "name": "name",
          "messages": [
            "Name must be a valid hostname."
          ]
        }
      ]
    }
  }
}

jooola avatar Jun 11 '25 09:06 jooola