henrygd/beszel · error
fingerprint file is empty
Error message
fingerprint file is empty
What it means
readFingerprint loads the fingerprint file from the data directory and trims whitespace. If the file reads successfully but contains nothing after trimming, it rejects the empty value with this error. It exists so callers like GetFingerprint fail fast instead of treating a blank file as a valid fingerprint.
Source
Thrown at agent/fingerprint.go:72
cpuModel = getCpuModelFromCpuinfo()
}
}
fingerprint = hostname + cpuModel
}
sum := sha256.Sum256([]byte(fingerprint))
return hex.EncodeToString(sum[:24])
}
// readFingerprint reads the saved fingerprint from the data directory.
func readFingerprint(dataDir string) (string, error) {
fp, err := os.ReadFile(filepath.Join(dataDir, fingerprintFileName))
if err != nil {
return "", err
}
s := strings.TrimSpace(string(fp))
if s == "" {
return "", errors.New("fingerprint file is empty")
}
return s, nil
}
// SaveFingerprint writes the fingerprint to the data directory.
func SaveFingerprint(dataDir, fingerprint string) error {
return os.WriteFile(filepath.Join(dataDir, fingerprintFileName), []byte(fingerprint), 0o644)
}
// DeleteFingerprint removes the saved fingerprint file from the data directory.
// Returns nil if the file does not exist (idempotent).
func DeleteFingerprint(dataDir string) error {
err := os.Remove(filepath.Join(dataDir, fingerprintFileName))
if errors.Is(err, os.ErrNotExist) {
return nil
}
return err
}View on GitHub (pinned to b38fb7dafa)
Solutions
- Delete the empty fingerprint file and restart the agent so it regenerates a fingerprint via SaveFingerprint.
- Verify the data directory is writable and has free space so the regenerated fingerprint persists.
- After regenerating, re-approve/re-add the agent on the hub if the fingerprint pairing changed.
Example fix
// before (empty file lingers, agent fails on startup) $ ls -l ~/.beszel/fingerprint -rw-r--r-- 0 bytes // after $ rm ~/.beszel/fingerprint $ sudo systemctl restart beszel-agent
Defensive patterns
Strategy: validation
Validate before calling
info, err := os.Stat(filepath.Join(dataDir, "fingerprint"))
if err == nil && info.Size() == 0 {
os.Remove(filepath.Join(dataDir, "fingerprint")) // force regeneration
} Try / catch
fp, err := agent.GetFingerprint()
if err != nil && err.Error() == "fingerprint file is empty" {
os.Remove(filepath.Join(dataDir, "fingerprint"))
if err := agent.SaveFingerprint(dataDir, newFingerprint()); err != nil {
log.Fatalf("regenerate fingerprint: %v", err)
}
} Prevention
- Never pre-create the fingerprint file manually; let SaveFingerprint write it.
- Monitor disk space so saves are not truncated.
- Ensure atomic/persisted storage for the data directory (no volatile tmpfs in production).
When it happens
Trigger: Calling agent.GetFingerprint() when the fingerprint file exists in the data dir but is 0 bytes, contains only whitespace/newlines, or was truncated by a failed SaveFingerprint/interrupted write.
Common situations: Disk-full conditions or crashes during first pairing that left a zero-length fingerprint file; manually creating the file empty in advance; a copy/restore step that preserved the filename but lost the content.
Related errors
- data directory not found
- no matching fingerprints
- fingerprint mismatch
- no fingerprint in response
- failed to create temp directory: %w
AI-assisted analysis of henrygd/beszel@b38fb7dafa (2026-08-31).
Data as JSON: /api/errors/73713f216d7c1b52.
Report an issue: GitHub.