{"record":{"id":"9dd0d4dc40e8aa2a","repo":"puppetlabs/puppet","slug":"epp-syntax-checker-the-text-to-check-must-be-a-st","errorCode":null,"errorMessage":"EPP syntax checker: the text to check must be a String.","messagePattern":"EPP syntax checker: the text to check must be a String\\.","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/syntax_checkers/epp.rb","lineNumber":18,"sourceCode":"# frozen_string_literal: true\n\n# A syntax checker for JSON.\n# @api public\nrequire_relative '../../puppet/syntax_checkers'\nclass Puppet::SyntaxCheckers::EPP < Puppet::Plugins::SyntaxCheckers::SyntaxChecker\n  # Checks the text for Puppet Language EPP syntax issues and reports them to the given acceptor.\n  #\n  # Error messages from the checker are capped at 100 chars from the source text.\n  #\n  # @param text [String] The text to check\n  # @param syntax [String] The syntax identifier in mime style (only accepts 'pp')\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, _(\"EPP syntax checker: the text to check must be a String.\") unless text.is_a?(String)\n    raise ArgumentError, _(\"EPP syntax checker: the syntax identifier must be a String, e.g. pp\") unless syntax == 'epp'\n    raise ArgumentError, _(\"EPP syntax checker: invalid Acceptor, got: '%{klass}'.\") % { klass: acceptor.class.name } unless acceptor.is_a?(Puppet::Pops::Validation::Acceptor)\n\n    begin\n      Puppet::Pops::Parser::EvaluatingParser::EvaluatingEppParser.singleton.parse_string(text)\n    rescue => e\n      # Cap the message to 100 chars and replace newlines\n      msg = _(\"EPP syntax checker: \\\"%{message}\\\"\") % { message: e.message().slice(0, 500).gsub(/\\r?\\n/, \"\\\\n\") }\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_EPP) { msg }\n      acceptor.accept(Puppet::Pops::Validation::Diagnostic.new(:error, issue, source_pos.file, source_pos, {}))\n    end\n  end\nend\n","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/syntax_checkers/epp.rb#L1-L36","documentation":"Error \"EPP syntax checker: the text to check must be a String.\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/syntax_checkers/epp.rb:18 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"}