{"record":{"id":"d894120122c746a7","repo":"hashicorp/nomad","slug":"failed-to-sync-temp-snapshot-v","errorCode":null,"errorMessage":"failed to sync temp snapshot: %v","messagePattern":"failed to sync temp snapshot: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"helper/snapshot/snapshot.go","lineNumber":292,"sourceCode":"\t\t}\n\t\tif err := os.Remove(snap.Name()); err != nil {\n\t\t\tlogger.Error(\"Failed to clean up temp snapshot\", \"error\", err)\n\t\t}\n\t}()\n\n\t// Read the archive.\n\tvar metadata raft.SnapshotMeta\n\tif err := read(decomp, &metadata, snap); err != nil {\n\t\treturn fmt.Errorf(\"failed to read snapshot file: %v\", err)\n\t}\n\n\tif err := concludeGzipRead(decomp); err != nil {\n\t\treturn err\n\t}\n\n\t// Sync and rewind the file so it's ready to be read again.\n\tif err := snap.Sync(); err != nil {\n\t\treturn fmt.Errorf(\"failed to sync temp snapshot: %v\", err)\n\t}\n\tif _, err := snap.Seek(0, 0); err != nil {\n\t\treturn fmt.Errorf(\"failed to rewind temp snapshot: %v\", err)\n\t}\n\n\t// Feed the snapshot into Raft.\n\tif err := r.Restore(&metadata, snap, 0); err != nil {\n\t\treturn fmt.Errorf(\"Raft error when restoring snapshot: %v\", err)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":274,"sourceCodeEnd":305,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/helper/snapshot/snapshot.go#L274-L305","documentation":"Once the snapshot has been fully written to the temp file, Restore() calls snap.Sync() to flush it to disk before rewinding and handing the file to Raft. This error wraps a failure of that fsync. It is rare and points to low-level I/O problems persisting the temp file's data.","triggerScenarios":"snap.Sync() fails during Restore — typically EIO from the disk, ENOSPC (filesystem full while flushing buffered data), or the underlying file descriptor becoming invalid (closed or I/O error on the device).","commonSituations":"Failing or full disks on the node; storage backend errors in containers/VMs; hardware or SAN issues surfacing as EIO during fsync.","solutions":["Read the wrapped %v cause and check dmesg/system logs for disk I/O errors.","Verify the filesystem holding the temp directory has free space (df) and is not read-only.","Check/replace failing storage hardware or migrate the node.","Retry the restore after the storage issue is resolved."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if err := syscall.Access(os.TempDir(), os.O_RDWR); err != nil {\n    return fmt.Errorf(\"temp storage not writable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := snapStore.Restore(data); err != nil && strings.Contains(err.Error(), \"failed to sync temp snapshot\") {\n    // check dmesg / disk health, then retry after storage recovers\n}","preventionTips":["Monitor disk health (SMART) and I/O error counters on nodes running restores.","Keep free space headroom on the temp filesystem.","Alert on EIO/ENOSPC kernel log messages.","Run restores on healthy nodes; avoid degraded RAID/failing volumes."],"tags":["filesystem","fsync","io","disk"],"backgroundTag":"disk-io-error","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}