ipfs/kubo · error

cannot read archive: %w

Error message

cannot read archive: %w

What it means

Raised by unpackTgz when tar.Reader.Next returns a non-EOF error while scanning the .tar.gz for the expected root/name entry; this means the archive is corrupt, truncated, or not a valid tar stream, so the migration binary cannot be located and extracted.

Source

Thrown at repo/fsrepo/migrations/unpack.go:52

	defer fi.Close()

	gzr, err := gzip.NewReader(fi)
	if err != nil {
		return fmt.Errorf("error opening gzip reader: %w", err)
	}
	defer gzr.Close()

	var bin io.Reader
	tarr := tar.NewReader(gzr)

	lookFor := root + "/" + name
	for {
		th, err := tarr.Next()
		if err != nil {
			if err == io.EOF {
				break
			}
			return fmt.Errorf("cannot read archive: %w", err)
		}

		if th.Name == lookFor {
			bin = tarr
			break
		}
	}

	if bin == nil {
		return errors.New("no binary found in archive")
	}

	return writeToPath(bin, out)
}

func unpackZip(arcPath, root, name, out string) error {
	zipr, err := zip.OpenReader(arcPath)
	if err != nil {

View on GitHub (pinned to 329838acdf)

Solutions

  1. Retry the download for an intact archive
  2. Verify checksum if available
  3. Fetch the binary manually from the official source if it persists
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at repo/fsrepo/migrations/unpack.go:52 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03). Data as JSON: /api/errors/3ab8e69f0fcc2d6e. Report an issue: GitHub.