{"record":{"id":"211d21e256eb365b","repo":"jordansissel/fpm","slug":"could-not-find-package-metadata-checked-for-meta","errorCode":null,"errorMessage":"Could not find package metadata. Checked for META.json, META.yml, and MetaCPAN API data","messagePattern":"Could not find package metadata\\. Checked for META\\.json, META\\.yml, and MetaCPAN API data","errorType":"validation","errorClass":"FPM::InvalidPackageConfiguration","httpStatus":null,"severity":"error","filePath":"lib/fpm/package/cpan.rb","lineNumber":92,"sourceCode":"      local_metadata = JSON.parse(File.read(File.join(moduledir, (\"META.json\"))))\n    elsif File.exist?(File.join(moduledir, (\"META.yml\")))\n      require \"yaml\"\n      local_metadata = YAML.load_file(File.join(moduledir, (\"META.yml\")))\n    elsif File.exist?(File.join(moduledir, \"MYMETA.json\"))\n      local_metadata = JSON.parse(File.read(File.join(moduledir, (\"MYMETA.json\"))))\n    elsif File.exist?(File.join(moduledir, (\"MYMETA.yml\")))\n      require \"yaml\"\n      local_metadata = YAML.load_file(File.join(moduledir, (\"MYMETA.yml\")))\n    end\n\n    # Merge the MetaCPAN query result and the metadata pulled from the local\n    # META file(s).  The local data overwrites the query data for all keys the\n    # two hashes have in common.  Merge with an empty hash if there was no\n    # local META file.\n    metadata = result.merge(local_metadata || {})\n\n    if metadata.empty?\n      raise FPM::InvalidPackageConfiguration,\n        \"Could not find package metadata. Checked for META.json, META.yml, and MetaCPAN API data\"\n    end\n\n    self.version = metadata[\"version\"]\n    self.description = metadata[\"abstract\"]\n\n    self.license = case metadata[\"license\"]\n      when Array; metadata[\"license\"].first\n      when nil; \"unknown\"\n      else; metadata[\"license\"]\n    end\n\n    unless metadata[\"release\"].nil?\n      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)","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/jordansissel/fpm/blob/b6d77ba72a560b687723376a0e5115c3a92634ad/lib/fpm/package/cpan.rb#L74-L110","documentation":"The cpan input builds metadata from two sources: a MetaCPAN API query for the module, and local META.json / META.yml / MYMETA.yml if present in the module directory. If both yield nothing (the merged hash is empty), FPM::InvalidPackageConfiguration is raised — fpm has no name or version to build from.","triggerScenarios":"Running 'fpm -s cpan -t deb Some::Module' offline or behind a blocking proxy (MetaCPAN query returns nothing) while the module directory has no META files; a typo'd module name not found on MetaCPAN; private/internal Perl distributions never published to CPAN.","commonSituations":"Air-gapped or firewalled build agents; corporate proxies blocking fastapi.metacpan.org; packaging internal modules; pointing -s cpan at a bare source dir where perl Makefile.PL was never run (no MYMETA generated).","solutions":["Run 'perl Makefile.PL' (or Build.PL) in the module dir to generate MYMETA, then pass the directory path to fpm","Verify MetaCPAN reachability: curl https://fastapi.metacpan.org/v1/module/Your::Module","For private modules, fall back to -s dir with explicit --name/--version, or vendor a META.yml into the dist","Double-check the module name spelling and that it exists on CPAN"],"exampleFix":"# before (offline, bare source dir)\nfpm -s cpan -t deb My::Internal::Module\n\n# after: generate local metadata, package from the directory\n(cd My-Internal-Module && perl Makefile.PL)\nfpm -s cpan -t deb ./My-Internal-Module","handlingStrategy":"try-catch","validationCode":"meta_sources = %w[META.json META.yml MYMETA.yml]\nhas_local_meta = meta_sources.any? { |m| File.exist?(File.join(module_dir, m)) }\nnet_ok = system('curl', '-fsS', 'https://fastapi.metacpan.org/v1/module/Your::Module', out: File::NULL, err: File::NULL)\nabort 'no CPAN metadata source available (offline and no META files)' unless has_local_meta || net_ok","typeGuard":null,"tryCatchPattern":"begin\n  pkg = FPM::Package::Cpan.new\n  pkg.input('Some::Module')\nrescue FPM::InvalidPackageConfiguration => e\n  warn \"no CPAN metadata found (#{e.message}); check network or add META.yml/MYMETA.yml\"\n  pkg.cleanup\nend","preventionTips":["Ship META.json/META.yml inside private Perl dists, or run perl Makefile.PL first to generate MYMETA","Verify MetaCPAN reachability from the build host before -s cpan runs","For air-gapped builds, vendor the module directory with metadata and package from the local path"],"tags":["fpm","cpan","perl","metadata","network","offline"],"backgroundTag":"missing-package-metadata","analyzedSha":"b6d77ba72a560b687723376a0e5115c3a92634ad","analyzedAt":"2026-08-21T16:39:02.570Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}