Puppet ENC gives ruby error: class or module required for rescue clause

Problem:

I am getting the ruby error “class or module required for rescue clause”, when I want to run the Puppet ENC against a created node in Foreman.

$ /etc/puppetlabs/puppet/node.rb myhost.domain.tld
class or module required for rescue clause

Expected outcome:

Correct output of node.rb

Foreman and Proxy versions:

Foreman 1.20.1
Foreman Proxy 1.20.1
Puppet 5.5.10
Puppet Server 5.3.7

Foreman and Proxy plugin versions:

Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
(for logs, surround with three back-ticks to get proper formatting, e.g.)

The puppetserver produces the following log:

2019-02-12 11:11:40,718 ERROR [qtp1008253324-60] [puppetserver] Puppet Server Error: Failed when searching for node myhost.domain.tld: Failed to find myhost.domain.tld via exec: Execution of '/etc/puppetlabs/puppet/node.rb myhost.domain.tld' returned 1: 
file:/opt/puppetlabs/server/apps/puppetserver/puppet-server-release.jar!/puppetserver-lib/puppet/server/execution.rb:56:in `execute'
file:/opt/puppetlabs/server/apps/puppetserver/puppet-server-release.jar!/puppetserver-lib/puppet/server/execution.rb:14:in `initialize_execution_stub'
org/jruby/RubyProc.java:281:in `call'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/execution.rb:220:in `execute'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/node/exec.rb:35:in `execute'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/exec.rb:19:in `find'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/node/exec.rb:17:in `find'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:198:in `find'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:343:in `find_node'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:340:in `find_node'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:381:in `node_from_request'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:49:in `find'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:198:in `find'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:121:in `do_find'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:48:in `call'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:260:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:47:in `call'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:82:in `process'
org/jruby/RubyArray.java:1613:in `each'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:81:in `process'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:87:in `process'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:87:in `process'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:64:in `process'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:62:in `process'
file:/opt/puppetlabs/server/apps/puppetserver/puppet-server-release.jar!/puppetserver-lib/puppet/server/master.rb:42:in `handleRequest'
Puppet$$Server$$Master_1725670435.gen:13:in `handleRequest'
request_handler_core.clj:273:in `invoke'
jruby_request.clj:48:in `invoke'
jruby_request.clj:33:in `invoke'
request_handler_service.clj:47:in `handle_request'
request_handler.clj:3:in `invoke'
request_handler.clj:3:in `invoke'
core.clj:2515:in `invoke'
ring_middleware.clj:284:in `invoke'
core.clj:170:in `invoke'
core.clj:216:in `invoke'
core.clj:47:in `invoke'
core.clj:357:in `invoke'
core.clj:53:in `invoke'
ringutils.clj:83:in `invoke'
master_core.clj:738:in `invoke'
ring.cljc:25:in `invoke'
ring.cljc:16:in `invoke'
comidi.clj:245:in `invoke'
http.clj:152:in `invoke'
http.clj:152:in `invoke'
http.clj:148:in `invoke'
comidi.clj:332:in `invoke'
jetty9_core.clj:434:in `invoke'
normalized_uri_helpers.clj:74:in `invoke'

Same here.
I double checked the parse_error from foreman/production.log.
Check your yaml Parameters in foreman. Dont use the minus in a comment end like
<%# -%>
It’s new, that -%> removing newlines…for me

Please tell us, if this helps.