multica-ai/multica · error

read binary: %w

Error message

read binary: %w

What it means

After locating the matching entry, io.ReadAll on the entry body failed; wrapped as 'read binary: %w'. The entry header was found, so this means the member's declared content could not be read — truncation of the final member, or a gzip/flate corruption deep in the stream that only surfaces when the entry bytes are consumed.

Source

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

	if err != nil {
		return nil, fmt.Errorf("gzip reader: %w", err)
	}
	defer gz.Close()

	tr := tar.NewReader(gz)
	for {
		hdr, err := tr.Next()
		if err == io.EOF {
			return nil, fmt.Errorf("binary %q not found in archive", name)
		}
		if err != nil {
			return nil, fmt.Errorf("read tar: %w", err)
		}
		// Match the binary name (may be prefixed with a directory).
		if filepath.Base(hdr.Name) == name && hdr.Typeflag == tar.TypeReg {
			data, err := io.ReadAll(tr)
			if err != nil {
				return nil, fmt.Errorf("read binary: %w", err)
			}
			return data, nil
		}
	}
}

// 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)

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Retry the update — transient body corruption typically clears on the next fetch.
  2. Manually extract the asset (tar -xzf) to confirm the member is complete in the published artifact.
  3. If the published asset is truncated, re-run the release upload so the archive and checksums.txt are consistent.
  4. Compare the downloaded asset size with the size listed on the GitHub release page.

Example fix

null
Defensive patterns

Strategy: retry

Try / catch

data, err := extractBinaryFromTarGz(r, "multica")
if err != nil && strings.HasPrefix(err.Error(), "read binary") {
    // truncated member: retry the full download; if persistent, re-publish the asset
}

Prevention

When it happens

Trigger: The archive ends before the binary member's declared size (truncated upload); flate.CorruptInputError from bit-level corruption that nonetheless matched a stale checksum; storage-level read errors when the archive source is a network body replayed from a buffer.

Common situations: Interrupted release uploads; CDN serving partial content with matching content-length edge cases; mirrors re-encoding the stream.

Related errors


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