ipfs/kubo · error

cannot open archive file: %w

Error message

cannot open archive file: %w

What it means

Raised by unpackTgz when os.Open fails on the downloaded migrations archive path; the wrapped error is typically a 'no such file or directory' or permission error, indicating the archive was not downloaded, was cleaned up, or the path is wrong before tar extraction begins.

Source

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

	var err error
	switch atype {
	case "tar.gz":
		err = unpackTgz(arcPath, root, name, out)
	case "zip":
		err = unpackZip(arcPath, root, name, out)
	default:
		err = fmt.Errorf("unrecognized archive type: %s", atype)
	}
	if err != nil {
		return err
	}
	return nil
}

func unpackTgz(arcPath, root, name, out string) error {
	fi, err := os.Open(arcPath)
	if err != nil {
		return fmt.Errorf("cannot open archive file: %w", err)
	}
	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

View on GitHub (pinned to 329838acdf)

Solutions

  1. Retry the download/migration; a partial download can leave a missing/partial file
  2. Check the migrations download/cache directory permissions
  3. Verify disk space
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at repo/fsrepo/migrations/unpack.go:32 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/7ad5cbf983ce8746. Report an issue: GitHub.