ruby/ruby · error · Gem::Package::TarInvalidError

tar is corrupt, name contains null byte

Error message

tar is corrupt, name contains null byte

What it means

Error "tar is corrupt, name contains null byte" thrown in ruby/ruby.

Source

Thrown at lib/rubygems/package/tar_reader/entry.rb:93

  end

  ##
  # Are we at the end of the tar entry?

  def eof?
    check_closed

    @read >= @header.size
  end

  ##
  # Full name of the tar entry

  def full_name
    @header.full_name.force_encoding(Encoding::UTF_8)
  rescue ArgumentError => e
    raise unless e.message == "string contains null byte"
    raise Gem::Package::TarInvalidError,
          "tar is corrupt, name contains null byte"
  end

  ##
  # Read one byte from the tar entry

  def getc
    return nil if eof?

    ret = @io.getc
    @read += 1 if ret

    ret
  end

  ##
  # Is this tar entry a directory?

View on GitHub (pinned to 0e5b888e1c)

When it happens

Trigger: Thrown at lib/rubygems/package/tar_reader/entry.rb:93 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruby/ruby@0e5b888e1c (2026-08-21). Data as JSON: /api/errors/34ca8443483edce2. Report an issue: GitHub.