{"record":{"id":"2757fe81f1c1742a","repo":"theforeman/foreman","slug":"the-specified-snippet-name-does-not-exist-or","errorCode":null,"errorMessage":"The specified snippet '#{name}' does not exist, or is not a snippet.","messagePattern":"The specified snippet '#(.+?)' does not exist, or is not a snippet\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"app/services/foreman/renderer/scope/macros/snippet_rendering.rb","lineNumber":51,"sourceCode":"              parametrized using variables.\n              The snippet rendering happens in the same context as the main template rendering, meaning all instance\n              variables and macros are available in that snippet. Variables passed to this snippet are available\n              only during the snippet rendering.'\n            required :name, String, desc: 'Name of the snippet template to render'\n            optional :options, Hash, desc: 'Rendering options, the only supported option is +variables+ which can also be set by specific keyword argument',\n                                     default: {}\n            optional :variables, Hash, desc: 'Every key will be registered as instance variable, e.g. key +enable_ntp+ will be available as +@enable_ntp+',\n                                       default: {}\n            returns String, desc: 'evaluated ERB of the snippet'\n            raises error: StandardError, desc: 'in case the snippet was not found in the current template source, e.g. a database.'\n            raises error: Foreman::Exception, desc: 'in case the snippet raised exception during rendering.'\n            example \"snippet('motd') # => 'Hello world'\"\n            example \"snippet('ntp_server', variables: { :enable_ntp => true) } # => '...'\"\n          end\n          def snippet(name, options = {}, variables: {})\n            template = source.find_snippet(name)\n            unless template\n              raise \"The specified snippet '#{name}' does not exist, or is not a snippet.\" unless options[:silent]\n              return\n            end\n\n            begin\n              snippet_variables = variables_keys.index_with { |key| instance_variable_get(\"@#{key}\") }\n                                                .symbolize_keys\n                                                .merge(variables)\n                                                .merge(options[:variables] || {})\n              template.render(renderer: renderer, host: host, variables: snippet_variables, params: params, mode: mode, source_klass: source&.class)\n            rescue ::Foreman::Exception => e\n              Foreman::Logging.exception('Error while rendering a snippet', e)\n              raise\n            rescue StandardError => exc\n              e = ::Foreman::Exception.new(N_(\"The snippet '%{name}' threw an error: %{exc}\"), { :name => name, :exc => exc })\n              e.set_backtrace exc.backtrace\n              raise e\n            end\n          end","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/services/foreman/renderer/scope/macros/snippet_rendering.rb#L33-L69","documentation":"Error \"The specified snippet '#{name}' does not exist, or is not a snippet.\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/services/foreman/renderer/scope/macros/snippet_rendering.rb:51 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6b05625475cfe6aac31a88f8c8ee6e62e4efe620","analyzedAt":"2026-08-23T17:46:34.094Z","schemaVersion":2},"datasetVersion":"2026-08-23T21:17:23.414Z"}