jordansissel/fpm · error · FPM::Package::Python::UnexpectedContent

Found a content body in METADATA file, but Metadata-Version(

Error message

Found a content body in METADATA file, but Metadata-Version(#{headers["Metadata-Version"]}) is below 2.1 and doesn't support this. This may be a bug in fpm or a malformed python package.

What it means

Error "Found a content body in METADATA file, but Metadata-Version(#{headers["Metadata-Version"]}) is below 2.1 and doesn't support this. This may be a bug in fpm or a malformed python package." thrown in jordansissel/fpm.

Source

Thrown at lib/fpm/package/python.rb:243

        # > RFC 822 format, any CRLF character has to be suffixed by 7 spaces
        # > followed by a pipe (“|”) char. As a result, the Description field is
        # > encoded into a folded field that can be interpreted by RFC822 parser [2].
        @description = @description.gsub!(/^       |/, "")
      end

      if !body.nil?
        if headers["Metadata-Version"].to_f >= 2.1
          # Per Python core-metadata spec:
          # > Changed in version 2.1: [Description] field may be specified in the message body instead.
          # 
          # The description is simply the rest of the METADATA file after the headers.
          @description = body
        elsif headers["Metadata-Version"].to_f >= 2.0
          # dnspython v1.15.0 has a description body and Metadata-Version 2.0 
          # this seems out of spec, but let's accept it anyway.
          @description = body
        else
          raise UnexpectedContent, "Found a content body in METADATA file, but Metadata-Version(#{headers["Metadata-Version"]}) is below 2.1 and doesn't support this. This may be a bug in fpm or a malformed python package."
        end

        # What to do if we find a description body but already have a Description field set in the headers?
        if headers.include?("Description")
          raise "Found a description in the body of the python package metadata, but the package already set the Description field. I don't know what to do. This is probably a bug in fpm."
        end
      end

      # XXX: The description field can be markdown, plain text, or reST. 
      # Content type is noted in the "Description-Content-Type" field
      # Should we transform this to plain text?
    end # process_description

    def process_license(headers)
      # Ignore the "License" field if License-Expression is also present.
      return if headers["Metadata-Version"].to_f >= 2.4 && headers.include?("License-Expression")

      # Deprecated field, License,  as described in python core-metadata:

View on GitHub (pinned to b6d77ba72a)

When it happens

Trigger: Thrown at lib/fpm/package/python.rb:243 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of jordansissel/fpm@b6d77ba72a (2026-08-21). Data as JSON: /api/errors/6d2fc8d1b7c37a41. Report an issue: GitHub.