Common errors
In addition to knowing how to use the puppet lookup
command, knowing some common errors can be useful in debugging Hiera.
-
Error:
CopyError: 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 1Cause:
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. -
Error:
CopyError: Could not run: (<unknown>): mapping values are not allowed in this context at line 3 column 10Cause:
This can be caused by using tabs for indentation instead of spaces. In general, avoid tab characters in yaml files.
-
Error:
CopyError: 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 HashThese types of errors often happen when you use
hiera_array()orhiera_hash(), but one or more of the found values are of a data type incompatible with that lookup.