{"record":{"id":"d82ebdebdd36f911","repo":"puppetlabs/puppet","slug":"unknown-function-name","errorCode":null,"errorMessage":"Unknown function '%{name}'","messagePattern":"Unknown function '%(.+?)'","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/evaluator/runtime3_support.rb","lineNumber":292,"sourceCode":"  # @raise [ArgumentError] 'unknown function' if the function does not exist\n  #\n  def external_call_function(name, args, scope, &block)\n    # Call via 4x API if the function exists there\n    loaders = scope.compiler.loaders\n    # Since this is a call from non puppet code, it is not possible to relate it to a module loader\n    # It is known where the call originates by using the scope associated module - but this is the calling scope\n    # and it does not defined the visibility of functions from a ruby function's perspective. Instead,\n    # this is done from the perspective of the environment.\n    loader = loaders.private_environment_loader\n    func = loader.load(:function, name) if loader\n    if func\n      Puppet::Util::Profiler.profile(name, [:functions, name]) do\n        return func.call(scope, *args, &block)\n      end\n    end\n\n    # Call via 3x API if function exists there\n    raise ArgumentError, _(\"Unknown function '%{name}'\") % { name: name } unless Puppet::Parser::Functions.function(name)\n\n    # Arguments must be mapped since functions are unaware of the new and magical creatures in 4x.\n    # NOTE: Passing an empty string last converts nil/:undef to empty string\n    mapped_args = Runtime3FunctionArgumentConverter.map_args(args, scope, '')\n    result = scope.send(\"function_#{name}\", mapped_args, &block)\n    # Prevent non r-value functions from leaking their result (they are not written to care about this)\n    Puppet::Parser::Functions.rvalue?(name) ? result : nil\n  end\n\n  def call_function(name, args, o, scope, &block)\n    file, line = extract_file_line(o)\n    loader = Adapters::LoaderAdapter.loader_for_model_object(o, file)\n    func = loader.load(:function, name) if loader\n    if func\n      Puppet::Util::Profiler.profile(name, [:functions, name]) do\n        # Add stack frame when calling.\n        return Puppet::Pops::PuppetStack.stack(file || '', line, func, :call, [scope, *args], &block)\n      end","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/evaluator/runtime3_support.rb#L274-L310","documentation":"Error \"Unknown function '%{name}'\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/pops/evaluator/runtime3_support.rb:292 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":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}