{"record":{"id":"45761596ebe9818f","repo":"jordansissel/fpm","slug":"unexpected-cpan-author-field-type-metadata-a","errorCode":null,"errorMessage":"Unexpected CPAN 'author' field type: #{metadata[\"author\"].class}. This is a bug.","messagePattern":"Unexpected CPAN 'author' field type: #(.+?)\\. This is a bug\\.","errorType":"validation","errorClass":"FPM::InvalidPackageConfiguration","httpStatus":null,"severity":"error","filePath":"lib/fpm/package/cpan.rb","lineNumber":124,"sourceCode":"      dist_name, _, dist_version = metadata[\"release\"].rpartition('-')\n      logger.info(\"Setting package name from 'distribution'\",\n                  :distribution => dist_name)\n      self.name = fix_name(dist_name)\n      self.provides = search_provided_modules(dist_name, dist_version)\n    else\n      logger.info(\"Setting package name from 'name'\",\n                   :name => metadata[\"name\"])\n      self.name = fix_name(metadata[\"name\"])\n      self.provides << cap_name(metadata[\"name\"]) + \" = #{self.version}\"\n    end\n\n    # author is not always set or it may be a string instead of an array\n    self.vendor = case metadata[\"author\"]\n      when String; metadata[\"author\"]\n      when Array; metadata[\"author\"].join(\", \")\n      when NilClass; \"No Vendor Or Author Provided\"\n      else\n        raise FPM::InvalidPackageConfiguration, \"Unexpected CPAN 'author' field type: #{metadata[\"author\"].class}. This is a bug.\"\n    end if metadata.include?(\"author\")\n\n    self.url = metadata[\"resources\"][\"homepage\"] rescue \"unknown\"\n\n    # TODO(sissel): figure out if this perl module compiles anything\n    # and set the architecture appropriately.\n    self.architecture = \"all\"\n\n    # Install any build/configure dependencies with cpanm.\n    # We'll install to a temporary directory.\n    logger.info(\"Installing any build or configure dependencies\")\n\n    if attributes[:cpan_sandbox_non_core?]\n      cpanm_flags = [\"-L\", build_path(\"cpan\"), moduledir]\n    else\n      cpanm_flags = [\"-l\", build_path(\"cpan\"), moduledir]\n    end\n","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/jordansissel/fpm/blob/b6d77ba72a560b687723376a0e5115c3a92634ad/lib/fpm/package/cpan.rb#L106-L142","documentation":"When setting vendor from CPAN metadata, a case statement accepts only String, Array, or nil for the 'author' field; any other class (in practice a Hash from an unusual MYMETA.yml/META.json) falls into the else branch and raises FPM::InvalidPackageConfiguration marked 'This is a bug' — an unexpected metadata shape that fpm's parser does not model.","triggerScenarios":"A hand-edited or tool-generated META/MYMETA file whose author is a mapping (author: {name: ..., email: ...}) instead of a string or list; YAML sources coercing the field into a non-standard type that then merges into the metadata.","commonSituations":"Developers hand-writing MYMETA.yml; internal metadata generators emitting structured author objects; older META samples pasted from other ecosystems.","solutions":["Normalize the field in META.json/META.yml/MYMETA.yml so author is a string or an array of strings, then rebuild","Delete stale MYMETA.* and regenerate with 'perl Makefile.PL' so well-formed metadata is produced","If the metadata is standards-compliant yet rejected, report it on the fpm tracker — the message itself declares it a bug"],"exampleFix":"# before (MYMETA.yml)\nauthor:\n  name: Alice\n  email: alice@example.com\n\n# after\nauthor:\n  - Alice <alice@example.com>","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"require 'yaml'\n\ndef sane_cpan_author?(path)\n  meta = YAML.load_file(path)\n  author = meta && meta['author']\n  author.nil? || author.is_a?(String) || (author.is_a?(Array) && author.all? { |a| a.is_a?(String) })\nend\n\nabort 'author field in MYMETA.yml must be a string or list of strings' unless sane_cpan_author?('MYMETA.yml')","tryCatchPattern":"begin\n  pkg = FPM::Package::Cpan.new\n  pkg.input(module_dir)\nrescue FPM::InvalidPackageConfiguration => e\n  abort \"malformed CPAN metadata (#{e.message}); normalize the author field in META/MYMETA\"\nend","preventionTips":["Validate generated META/MYMETA files in the module's own test suite","Regenerate MYMETA with perl Makefile.PL instead of hand-editing","If metadata is spec-compliant but rejected, check the fpm tracker for a fix and pin a known-good version"],"tags":["fpm","cpan","perl","metadata","yaml","type-mismatch"],"backgroundTag":"unexpected-metadata-type","analyzedSha":"b6d77ba72a560b687723376a0e5115c3a92634ad","analyzedAt":"2026-08-21T16:39:02.570Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}