Puppet has the unfortunate habit of printing syntax errors that can make no sense whatsoever - usually in the form "Syntax error at ' '; expected ' '". This page attempts to document some of the syntax errors that can be encountered, and what might be causing those errors.
Syntax error at '}'; expected '}' at manifest.pp:nnn
service { "fred" }
This contrived example demonstrates one way to get the very confusing error of Puppet's parser expecting what it found. In this example, the colon ( : ) is missing after the service title. A variant looks like
service { "fred"
ensure => running
}
and the error would be Syntax error at 'ensure'; expected '}' .
Syntax error at ':'; expected ']' at manifest.pp:nnn
classname::define_name {
"jdbc/automation":
cpoolid => "automationPool",
require => [ Classname::other_define_name["automationPool"] ],
}
The problem here is that Puppet requires that object references in the require lines to begin with a capital letter. However, since this is a reference to a class and a define, the define also needs to have a capital letter, so Classname::Other_define_name would be the correct syntax.
Could not match '_define_name' at manifest.pp:nnn on node nodename
case $ensure {
"present": {
_define_name {
"$title":
user => $user,
}
}
}
This one is simple - you cannot begin a function name (define name) with an underscore.
Duplicate definition: Classname::Define_name[system] is already defined in file manifest.pp at line nnn; cannot redefine at manifest.pp:nnn on node nodename
Classname::define_name {
"system":
properties => "Name=system";
.....
"system":
properties => "Name=system";
}
The most confusing part of this error is that the line numbers are usually the same - this is the case when using the block format that Puppet supports for a resource definition. In this contrived example, the system entry has been defined twice, so one of them needs removing.
Syntax error at '=>'; expected ')'
define foo($param => 'value') { ... }
Default values for parameters are assigned, not defined, therefore a '=', not a '=>' operator is needed.
err: Exported resource Blah[$some_title] cannot override local resource on node $nodename
While this is not a classic "syntax" error, it is a annoing error none-the-less. The actual error tells you that you have a local resource Blah[$some_title] that puppet refuses to overwrite with a collected resource of the same name. What most often happens, that the same resource is exported by two nodes. One of them is collected first and when trying to collect the second resource, this error happens as the first is already converted to a "local" resource.