{"record":{"id":"83e0eae3c36bfa41","repo":"puppetlabs/puppet","slug":"base64-syntax-checker-invalid-acceptor-got-k","errorCode":null,"errorMessage":"Base64 syntax checker: invalid Acceptor, got: '%{klass}'.","messagePattern":"Base64 syntax checker: invalid Acceptor, got: '%(.+?)'\\.","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/syntax_checkers/base64.rb","lineNumber":21,"sourceCode":"# A syntax checker for Base64.\n# @api public\nrequire_relative '../../puppet/syntax_checkers'\nrequire 'base64'\nclass Puppet::SyntaxCheckers::Base64 < Puppet::Plugins::SyntaxCheckers::SyntaxChecker\n  # Checks the text for BASE64 syntax issues and reports them to the given acceptor.\n  # This checker allows the most relaxed form of Base64, including newlines and missing padding.\n  # It also accept URLsafe input.\n  #\n  # @param text [String] The text to check\n  # @param syntax [String] The syntax identifier in mime style (e.g. 'base64', 'text/xxx+base64')\n  # @param acceptor [#accept] A Diagnostic acceptor\n  # @param source_pos [Puppet::Pops::Adapters::SourcePosAdapter] A source pos adapter with location information\n  # @api public\n  #\n  def check(text, syntax, acceptor, source_pos)\n    raise ArgumentError, _(\"Base64 syntax checker: the text to check must be a String.\") unless text.is_a?(String)\n    raise ArgumentError, _(\"Base64 syntax checker: the syntax identifier must be a String, e.g. json, data+json\") unless syntax.is_a?(String)\n    raise ArgumentError, _(\"Base64 syntax checker: invalid Acceptor, got: '%{klass}'.\") % { klass: acceptor.class.name } unless acceptor.is_a?(Puppet::Pops::Validation::Acceptor)\n\n    cleaned_text = text.gsub(/[\\r?\\n[:blank:]]/, '')\n    begin\n      # Do a strict decode64 on text with all whitespace stripped since the non strict version\n      # simply skips all non base64 characters\n      Base64.strict_decode64(cleaned_text)\n    rescue\n      msg = if (cleaned_text.bytes.to_a.size * 8) % 6 != 0\n              _(\"Base64 syntax checker: Cannot parse invalid Base64 string - padding is not correct\")\n            else\n              _(\"Base64 syntax checker: Cannot parse invalid Base64 string - contains letters outside strict base 64 range (or whitespace)\")\n            end\n\n      # TODO: improve the pops API to allow simpler diagnostic creation while still maintaining capabilities\n      # and the issue code. (In this case especially, where there is only a single error message being issued).\n      #\n      issue = Puppet::Pops::Issues.issue(:ILLEGAL_BASE64) { msg }\n      acceptor.accept(Puppet::Pops::Validation::Diagnostic.new(:error, issue, source_pos.file, source_pos, {}))","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/syntax_checkers/base64.rb#L3-L39","documentation":"Error \"Base64 syntax checker: invalid Acceptor, got: '%{klass}'.\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/syntax_checkers/base64.rb:21 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"}