puppetlabs/puppet · error · ArgumentError
' ' is not a supported format for type generation.
Error message
'%{format}' is not a supported format for type generation. What it means
Raised from the `before_action` hook of the `--format` option in the `puppet generate types` face: the requested format is not in the allowlist `['pcore']`. Pcore is the only generation format that exists; the check runs before any generation work starts, so no files are written when it fires. The match is exact, so casing variants such as 'Pcore' are also rejected.
Solutions
- Omit `--format` entirely — it defaults to 'pcore'
- Or pass the exact value: `puppet generate types --format pcore`
- Remove format-selection logic from wrappers; there is no second format to choose
Example fix
# before puppet generate types --format json # after puppet generate types --format pcore # or simply puppet generate types
Defensive patterns
Strategy: validation
Validate before calling
fmt = options.fetch(:format, 'pcore')
raise ArgumentError, "unsupported format #{fmt}" unless %w[pcore].include?(fmt) Type guard
def supported_generate_format?(fmt) %w[pcore].include?(fmt.to_s) end
Prevention
- Omit --format; the default 'pcore' is the only value
- Don't build format-plumbing around commands with a single format
- Gate wrapper options against `puppet generate types --help` output
When it happens
Trigger: `puppet generate types --format json` (or any value other than the exact string 'pcore'); wrappers exposing a configurable format and defaulting to something else.
Common situations: Scripts written against a speculative/imagined API; attempts to generate JSON schema or protobuf output that Puppet never supported; copy-paste from other tools' docs.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- The output directory
- a data type can only have one implementation
- a data type can only have one interface
- a data type must have an interface
- attempt to # # annotation declared on #
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/fd7cd4e8d8ecf99d.
Report an issue: GitHub.
Appendix: source
Thrown at lib/puppet/face/generate.rb:38
between different environments.
EOT
examples <<-'EOT'
Generate Puppet type definitions for all custom resource types in the current environment:
$ puppet generate types
Generate Puppet type definitions for all custom resource types in the specified environment:
$ puppet generate types --environment development
EOT
option '--format ' + _('<format>') do
summary _('The generation output format to use. Supported formats: pcore.')
default_to { 'pcore' }
before_action do |_, _, options|
raise ArgumentError, _("'%{format}' is not a supported format for type generation.") % { format: options[:format] } unless ['pcore'].include?(options[:format])
end
end
option '--force' do
summary _('Forces the generation of output files (skips up-to-date checks).')
default_to { false }
end
when_invoked do |options|
generator = Puppet::Generate::Type
inputs = generator.find_inputs(options[:format].to_sym)
environment = Puppet.lookup(:current_environment)
# get the common output directory (in <envroot>/.resource_types) - create it if it does not exists
# error if it exists and is not a directory
#
path_to_env = environment.configuration.path_to_env
outputdir = File.join(path_to_env, '.resource_types')View on GitHub (pinned to e227c27540)