{"record":{"id":"5007b0c4deee5e69","repo":"puppetlabs/puppet","slug":"the-parameter-name-is-invalid-e-message","errorCode":null,"errorMessage":"The parameter '$#{name}' is invalid: #{e.message}","messagePattern":"The parameter '\\$#(.+?)' is invalid: #(.+?)","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/info_service/class_information_service.rb","lineNumber":94,"sourceCode":"\n    structure[:type] = typeexpr_to_string(p.name, p.type_expr)\n    structure\n  end\n\n  def extract_default(structure, p)\n    value_expr = p.value\n    return structure if value_expr.nil?\n\n    default_value = value_as_literal(value_expr)\n    structure[:default_literal] = default_value unless default_value.nil?\n    structure[:default_source] = extract_value_source(value_expr)\n    structure\n  end\n\n  def typeexpr_to_string(name, type_expr)\n    type_parser.interpret_any(type_expr, nil).to_s\n  rescue Puppet::ParseError => e\n    raise Puppet::Error, \"The parameter '$#{name}' is invalid: #{e.message}\", e.backtrace\n  end\n\n  def value_as_literal(value_expr)\n    catch(:not_literal) do\n      return literal_evaluator.literal(value_expr)\n    end\n    nil\n  end\n\n  # Extracts the source for the expression\n  def extract_value_source(value_expr)\n    value_expr.locator.extract_tree_text(value_expr)\n  end\nend\n","sourceCodeStart":76,"sourceCodeEnd":109,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/info_service/class_information_service.rb#L76-L109","documentation":"While extracting class documentation, ClassInformationService interprets each parameter's type expression with the POPS type parser (type_parser.interpret_any). If interpretation raises Puppet::ParseError, it is re-raised as Puppet::Error prefixed with the parameter name. The manifest's class parameter has a type expression the current Puppet version cannot resolve — e.g., an undefined type alias, a syntax error in the type, or an expression that is not a type at all (default-value expression leaking into the type slot).","triggerScenarios":"Running class-info extraction (puppet Strings adjacent tooling, puppetserver class endpoints) on a manifest like 'class web(NotAlias::Defined $port)' where NotAlias::Defined is never defined/autloaded, or 'class web(8080 $port)' where a literal sits in the type position, or a type expression using newer syntax on an older parser.","commonSituations":"Type aliases living in a module that is not in the modulepath when the doc extraction runs; manifests authored with future/newer Puppet syntax parsed by an older Puppet; typos in namespaced type aliases; parameter list syntax drift after language changes.","solutions":["Open the manifest at the named parameter and fix the type expression (the embedded e.message carries file/line)","Verify the type alias resolves: run `puppet parser validate <manifest>` in the same environment/modulepath context","Ensure the module defining the alias is present under the environment's modulepath used by the extraction call","For version mismatches, run the doc/class-info task with the same Puppet version that compiles the code"],"exampleFix":"# before (manifest)\nclass ntp(\n  Port::Unix $port = 123,   # Port::Unix alias not autoloadable in this env\n) { }\n# Error: The parameter '$port' is invalid: Undefined type 'Port::Unix'\n\n# after\nclass ntp(\n  Stdlib::Port $port = 123,  # stdlib present in modulepath\n) { }","handlingStrategy":"try-catch","validationCode":"require 'puppet/pops'\nparser = Puppet::Pops::Parser::EvaluatingParser.new\nmanifest_files.each do |f|\n  parser.parse_file(f)  # raises Puppet::ParseError early with file/line\nend","typeGuard":null,"tryCatchPattern":"begin\n  Puppet::InfoService::ClassInformationService.new.classes_per_environment(env_hash)\nrescue Puppet::Error => e\n  raise unless e.message =~ /\\$\\w+' is invalid/\n  Puppet.warning \"skipping #{e.message}\"  # quarantine broken manifests, keep doc run alive\nend","preventionTips":["Run `puppet parser validate` on all manifests in CI with the same modulepath as production","Keep type aliases in modules that are always present when docs/extraction runs","Parse-manifests-first pipelines surface type errors before class-info extraction"],"tags":["puppet","type-alias","parse-error","manifest","class-docs"],"backgroundTag":"type-parse-error","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}