{"record":{"id":"75ddaca03c56c34e","repo":"hashicorp/nomad","slug":"failed-to-rewind-temp-snapshot-v","errorCode":null,"errorMessage":"failed to rewind temp snapshot: %v","messagePattern":"failed to rewind temp snapshot: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"helper/snapshot/snapshot.go","lineNumber":295,"sourceCode":"\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":277,"sourceCodeEnd":305,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/helper/snapshot/snapshot.go#L277-L305","documentation":"Restore() rewinds the temp snapshot file with snap.Seek(0, 0) so Raft can read it from the beginning. This error wraps a seek failure. It is very rare and indicates the file descriptor is no longer usable for seeking (invalid or errored file).","triggerScenarios":"snap.Seek(0, 0) returns an error during Restore — practically only when the file descriptor is invalid/closed or an underlying I/O error occurs on the device (e.g. EBADF, EIO).","commonSituations":"Filesystem/driver errors on the temp storage; extremely unusual conditions like the file being closed early due to a prior defer or descriptor exhaustion (EMFILE).","solutions":["Check the wrapped %v cause for EBADF/EMFILE/EIO and correlate with system logs.","Verify no other code closed the temp file descriptor before this point.","Check the process's open-file limit (ulimit -n) if EMFILE is reported.","Retry the restore after fixing the underlying filesystem/descriptor issue."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := snapStore.Restore(data); err != nil && strings.Contains(err.Error(), \"failed to rewind temp snapshot\") {\n    // log the wrapped cause; check fd limits and filesystem health, then retry\n}","preventionTips":["Raise RLIMIT_NOFILE if the process opens many files.","Ensure nothing else closes or reuses the temp file descriptor during restore.","Keep the kernel/filesystem healthy; this error is almost always a symptom of deeper I/O failure."],"tags":["filesystem","seek","io","file-descriptor"],"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"}