{"record":{"id":"fd7cd4e8d8ecf99d","repo":"puppetlabs/puppet","slug":"format-is-not-a-supported-format-for-type-gen","errorCode":null,"errorMessage":"'%{format}' is not a supported format for type generation.","messagePattern":"'%(.+?)' is not a supported format for type generation\\.","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/face/generate.rb","lineNumber":38,"sourceCode":"      between different environments.\n    EOT\n\n    examples <<-'EOT'\n      Generate Puppet type definitions for all custom resource types in the current environment:\n\n          $ puppet generate types\n\n      Generate Puppet type definitions for all custom resource types in the specified environment:\n\n          $ puppet generate types --environment development\n    EOT\n\n    option '--format ' + _('<format>') do\n      summary _('The generation output format to use. Supported formats: pcore.')\n      default_to { 'pcore' }\n\n      before_action do |_, _, options|\n        raise ArgumentError, _(\"'%{format}' is not a supported format for type generation.\") % { format: options[:format] } unless ['pcore'].include?(options[:format])\n      end\n    end\n\n    option '--force' do\n      summary _('Forces the generation of output files (skips up-to-date checks).')\n      default_to { false }\n    end\n\n    when_invoked do |options|\n      generator = Puppet::Generate::Type\n      inputs = generator.find_inputs(options[:format].to_sym)\n      environment = Puppet.lookup(:current_environment)\n\n      # get the common output directory (in <envroot>/.resource_types) - create it if it does not exists\n      # error if it exists and is not a directory\n      #\n      path_to_env = environment.configuration.path_to_env\n      outputdir = File.join(path_to_env, '.resource_types')","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/face/generate.rb#L20-L56","documentation":"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.","triggerScenarios":"`puppet generate types --format json` (or any value other than the exact string 'pcore'); wrappers exposing a configurable format and defaulting to something else.","commonSituations":"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.","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"],"exampleFix":"# before\npuppet generate types --format json\n# after\npuppet generate types --format pcore\n# or simply\npuppet generate types","handlingStrategy":"validation","validationCode":"fmt = options.fetch(:format, 'pcore')\nraise ArgumentError, \"unsupported format #{fmt}\" unless %w[pcore].include?(fmt)","typeGuard":"def supported_generate_format?(fmt)\n  %w[pcore].include?(fmt.to_s)\nend","tryCatchPattern":null,"preventionTips":["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"],"tags":["puppet-generate","types","option-validation","pcore"],"backgroundTag":"invalid-option-value","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}