Diagnosing duplicate declaration errors
Every Puppet resource must have a unique resource name. If a resource is declared twice in the catalog, Puppet displays the following error: 'Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Resource[name]...'
.
Duplicate declaration errors are very common and sometimes quite difficult to rectify. If it is a simple case, where a resource is declared twice with the same name, Puppet rightfully reports which files, and the line numbers in files, are clashing. Here is an example of a scenario when a notify
resource has been declared twice with the same name:
Let's take a look at the preceding error message in detail, and see what information we can find from it so that it helps us troubleshoot the problem.
There are three important elements squeezed into one very long error message. The first piece of information that is relevant to us is Error 400 on SERVER: Duplicate declaration: Notify[Hello from ENC] is...