Common errors

In addition to knowing how to use the puppet lookup command, knowing some common errors can be useful in debugging Hiera.

  1. Error:
    Error: Could not run: (<unknown>): mapping values are not allowed in this context at line 2 column 8
    Error: Could not run: (<unknown>): did not find expected '-' indicator while parsing a block collection at line 1 column 1

    Cause:

    The opening --- could be malformed. If it gets converted into a unicode character, such as , or if there is a space at the start of the line ---, or in between the three dashes - --, you might get an error like this.

  2. Error:
    Error: Could not run: (<unknown>): mapping values are not allowed in this context at line 3 column 10
    

    Cause:

    This can be caused by using tabs for indentation instead of spaces. In general, avoid tab characters in yaml files.

  3. Error:
    Error: Could not run: Hiera type mismatch: expected Hash and got String
    Error: Could not run: Hiera type mismatch: expected Hash and got Array
    Error: Could not run: Hiera type mismatch: expected Array and got Hash

    These types of errors often happen when you use hiera_array() or hiera_hash(), but one or more of the found values are of a data type incompatible with that lookup.