puppetlabs/puppet · error · ArgumentError

Base64 syntax checker: invalid Acceptor, got

Error message

Base64 syntax checker: invalid Acceptor, got: '%{klass}'.

What it means

ArgumentError raised at the top of Puppet::SyntaxCheckers::Base64#check as an input-contract guard: the acceptor argument is not a Puppet::Pops::Validation::Acceptor, so diagnostics cannot be reported. The message names the actual class received ('%{klass}'), pointing at a caller that passed the wrong object into the checker plugin API.

Solutions

  1. Create and pass a Puppet::Pops::Validation::Acceptor (e.g. via Puppet::Pops::Validation::ValidatorFactory).
  2. Fix the caller that passed a wrong diagnostic-collecting object instead of an Acceptor.
  3. Use the diagnostics API (acceptor.accept) expected by the syntax-checker plugin contract.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at lib/puppet/syntax_checkers/base64.rb:21 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/83e0eae3c36bfa41. Report an issue: GitHub.

Appendix: source

Thrown at lib/puppet/syntax_checkers/base64.rb:21

# A syntax checker for Base64.
# @api public
require_relative '../../puppet/syntax_checkers'
require 'base64'
class Puppet::SyntaxCheckers::Base64 < Puppet::Plugins::SyntaxCheckers::SyntaxChecker
  # Checks the text for BASE64 syntax issues and reports them to the given acceptor.
  # This checker allows the most relaxed form of Base64, including newlines and missing padding.
  # It also accept URLsafe input.
  #
  # @param text [String] The text to check
  # @param syntax [String] The syntax identifier in mime style (e.g. 'base64', 'text/xxx+base64')
  # @param acceptor [#accept] A Diagnostic acceptor
  # @param source_pos [Puppet::Pops::Adapters::SourcePosAdapter] A source pos adapter with location information
  # @api public
  #
  def check(text, syntax, acceptor, source_pos)
    raise ArgumentError, _("Base64 syntax checker: the text to check must be a String.") unless text.is_a?(String)
    raise ArgumentError, _("Base64 syntax checker: the syntax identifier must be a String, e.g. json, data+json") unless syntax.is_a?(String)
    raise ArgumentError, _("Base64 syntax checker: invalid Acceptor, got: '%{klass}'.") % { klass: acceptor.class.name } unless acceptor.is_a?(Puppet::Pops::Validation::Acceptor)

    cleaned_text = text.gsub(/[\r?\n[:blank:]]/, '')
    begin
      # Do a strict decode64 on text with all whitespace stripped since the non strict version
      # simply skips all non base64 characters
      Base64.strict_decode64(cleaned_text)
    rescue
      msg = if (cleaned_text.bytes.to_a.size * 8) % 6 != 0
              _("Base64 syntax checker: Cannot parse invalid Base64 string - padding is not correct")
            else
              _("Base64 syntax checker: Cannot parse invalid Base64 string - contains letters outside strict base 64 range (or whitespace)")
            end

      # TODO: improve the pops API to allow simpler diagnostic creation while still maintaining capabilities
      # and the issue code. (In this case especially, where there is only a single error message being issued).
      #
      issue = Puppet::Pops::Issues.issue(:ILLEGAL_BASE64) { msg }
      acceptor.accept(Puppet::Pops::Validation::Diagnostic.new(:error, issue, source_pos.file, source_pos, {}))

View on GitHub (pinned to e227c27540)