henrygd/beszel · error
failed to calculate release checksum: %w
Error message
failed to calculate release checksum: %w
What it means
After opening the file, the library streams it into a sha256 hash via io.Copy. If reading fails mid-stream — disk I/O error, file truncated/removed while reading — the read error is wrapped with this message. This is about failing to compute the checksum, not a mismatch.
Source
Thrown at internal/ghupdate/checksum.go:35
}
if !strings.EqualFold(algorithm, "sha256") {
return fmt.Errorf("unsupported release digest algorithm %q", algorithm)
}
expected, err := hex.DecodeString(expectedHex)
if err != nil || len(expected) != sha256.Size {
return fmt.Errorf("invalid SHA-256 release digest %q", digest)
}
file, err := os.Open(path)
if err != nil {
return fmt.Errorf("failed to open release for checksum verification: %w", err)
}
defer file.Close()
hash := sha256.New()
if _, err := io.Copy(hash, file); err != nil {
return fmt.Errorf("failed to calculate release checksum: %w", err)
}
actual := hash.Sum(nil)
if !bytes.Equal(actual, expected) {
return fmt.Errorf("release checksum mismatch: expected %s, got %s", expectedHex, hex.EncodeToString(actual))
}
return nil
}
View on GitHub (pinned to b38fb7dafa)
Solutions
- Re-run the update; if the temp dir is on unstable storage, set Config.DataDir to a local reliable path.
- Check `dmesg`/system logs for disk I/O errors and run fsck or replace failing hardware.
- Ensure nothing concurrently deletes or truncates files in DataDir while the updater runs.
- Verify free disk space with `df -h` and the health of the mount hosting DataDir.
Example fix
// before
Update(ghupdate.Config{DataDir: "/mnt/nfs/shared"}) // flaky NFS reads
// after
Update(ghupdate.Config{DataDir: "/var/lib/beszel"}) // local disk Defensive patterns
Strategy: retry
Validate before calling
if fi, err := os.Stat(cfg.DataDir); err == nil {
if st, err := os.Statfs(cfg.DataDir); err == nil && st.Bavail == 0 {
return errors.New("DataDir filesystem is full; free space before updating")
}
} Try / catch
var updated bool
var lastErr error
for i := 0; i < 3; i++ {
updated, lastErr = ghupdate.Update(cfg)
if lastErr == nil || !strings.Contains(lastErr.Error(), "failed to calculate release checksum") {
break
}
time.Sleep(time.Second) // transient I/O error; retry
} Prevention
- Monitor disk health (SMART) and free space on the volume hosting DataDir.
- Avoid running the updater concurrently with other processes that touch DataDir.
- Prefer local disks over NFS/CIFS for DataDir.
When it happens
Trigger: ghupdate.Update -> update -> verifyAssetChecksum when io.Copy(hash, file) returns an error: hardware/disk I/O failure, file deleted or truncated by another process during hashing, or an fs error caused by a failing mount.
Common situations: Failing or full disks; network filesystems (NFS/CIFS) dropping the file mid-read; concurrent cleanup of the temp release directory; corrupted filesystem after a crash.
Related errors
- failed to open release for checksum verification: %w
- data directory not found
- fingerprint file is empty
- scanner error: %w
- failed to create temp directory: %w
AI-assisted analysis of henrygd/beszel@b38fb7dafa (2026-08-31).
Data as JSON: /api/errors/4997dd502a799bbf.
Report an issue: GitHub.