multica-ai/multica · error

open zip entry: %w

Error message

open zip entry: %w

What it means

Returned by extractBinaryFromZip when the matching zip entry's Open() call fails. zip.File.Open fails when the entry header is corrupt, the compression method is unsupported by the Go zip package, or the local file header disagrees with the central directory. The archive parsed, but this specific member cannot be opened for reading.

Source

Thrown at server/internal/cli/update.go:528

// extractBinaryFromZip reads a .zip stream and returns the contents of the
// named file entry. The zip format requires random access, so the full archive
// is buffered in memory.
func extractBinaryFromZip(r io.Reader, name string) ([]byte, error) {
	buf, err := io.ReadAll(r)
	if err != nil {
		return nil, fmt.Errorf("read zip data: %w", err)
	}

	zr, err := zip.NewReader(bytes.NewReader(buf), int64(len(buf)))
	if err != nil {
		return nil, fmt.Errorf("zip reader: %w", err)
	}

	for _, f := range zr.File {
		if filepath.Base(f.Name) == name && !f.FileInfo().IsDir() {
			rc, err := f.Open()
			if err != nil {
				return nil, fmt.Errorf("open zip entry: %w", err)
			}
			defer rc.Close()

			data, err := io.ReadAll(rc)
			if err != nil {
				return nil, fmt.Errorf("read binary: %w", err)
			}
			return data, nil
		}
	}
	return nil, fmt.Errorf("binary %q not found in archive", name)
}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Unzip the downloaded artifact manually ('unzip -t release.zip') to confirm which entry is corrupt
  2. Re-download the release; if it reproduces, the published asset itself is broken — rebuild/re-upload it
  3. If you control packaging, create zips with standard Deflate or Store methods via archive/zip itself
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight: confirm the entry opens cleanly before relying on it.
func zipEntryOpens(zr *zip.Reader, name string) bool {
    for _, f := range zr.File {
        if filepath.Base(f.Name) == name && !f.FileInfo().IsDir() {
            rc, err := f.Open()
            if err != nil {
                return false
            }
            rc.Close()
            return true
        }
    }
    return false
}

Try / catch

Treat this error as 'corrupt artifact': do not retry in-process; re-download once from the source URL and abort if it reproduces.

Prevention

When it happens

Trigger: Calling extractBinaryFromZip on an archive where the target entry (the platform binary) uses an exotic compression method, was corrupted in transit while the central directory stayed intact, or was produced by a packager with local-header/central-directory mismatches.

Common situations: Hand-crafted or repacked release zips (e.g. stripped with a nonstandard tool), partial corruption that only affects the entry's local header, or archives created with compression settings Go's archive/zip does not support (e.g. some LZMA variants).

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/5bf637f6aebb6f85. Report an issue: GitHub.