{"record":{"id":"052d4b7ba4b069bf","repo":"wasmerio/wasmer","slug":"journal-restore-error-failed-renumber-file-descri","errorCode":null,"errorMessage":"journal restore error: failed renumber file descriptor after epoll create (from={}, to={}) - {}","messagePattern":"journal restore error: failed renumber file descriptor after epoll create \\(from=(.+?), to=(.+?)\\) - (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/wasix/src/journal/effector/syscalls/epoll_create.rs","lineNumber":19,"sourceCode":"use super::*;\n\nimpl JournalEffector {\n    pub fn save_epoll_create(ctx: &mut FunctionEnvMut<'_, WasiEnv>, fd: Fd) -> anyhow::Result<()> {\n        Self::save_event(ctx, JournalEntry::EpollCreateV1 { fd })\n    }\n\n    pub fn apply_epoll_create(ctx: &mut FunctionEnvMut<'_, WasiEnv>, fd: Fd) -> anyhow::Result<()> {\n        let ret_fd = crate::syscalls::epoll_create_internal(ctx, Some(fd))\n            .map_err(|err| {\n                anyhow::format_err!(\"journal restore error: failed to create epoll - {err}\")\n            })?\n            .map_err(|err| {\n                anyhow::format_err!(\"journal restore error: failed to create epoll - {err}\")\n            })?;\n\n        let ret = crate::syscalls::fd_renumber_internal(ctx, ret_fd, fd);\n        if !matches!(ret, Ok(Errno::Success)) {\n            bail!(\n                \"journal restore error: failed renumber file descriptor after epoll create (from={}, to={}) - {}\",\n                ret_fd,\n                fd,\n                ret.unwrap_or(Errno::Unknown)\n            );\n        }\n\n        Ok(())\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/wasix/src/journal/effector/syscalls/epoll_create.rs#L1-L30","documentation":"apply_epoll_create creates an epoll instance during journal replay, then calls fd_renumber_internal to move the newly allocated fd to the fd recorded in the journal. If the renumber fails, this error fires, meaning the restored process's fd table could not match the snapshotted layout.","triggerScenarios":"Journal restore replaying an EpollCreate entry when fd_renumber_internal fails (e.g. target fd already occupied/invalid, or internal fd allocation returned an unexpected fd).","commonSituations":"Restoring a snapshot whose fd table conflicts with fds opened during restore setup; corrupted or partially-applied journals; runtime version mismatch between snapshot creation and restore.","solutions":["Take a fresh snapshot and retry the restore.","Inspect the fd table of the restoring environment for conflicts at the target fd number.","Use the same wasix runtime version for snapshot and restore.","Verify the journal is complete and not truncated/corrupted."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Ensure the target fd slot is free before restore replay\n// (conceptual check: rebuild fd table expectations from the journal header)\nlet expected_fds: Vec<u32> = journal.fd_allocations();\nif expected_fds.iter().any(|fd| env.fd_in_use(*fd)) {\n    return Err(anyhow::anyhow!(\"fd conflict during restore; reset fd table first\"));\n}","typeGuard":null,"tryCatchPattern":"match restore_from_journal(&env, &journal) {\n    Err(e) if e.to_string().contains(\"epoll create\") => {\n        eprintln!(\"journal restore fd conflict: {e}; retaking snapshot recommended\");\n        retake_snapshot_and_resume()?;\n    }\n    other => other?,\n}","preventionTips":["Keep capture and restore runtime versions identical.","Validate journal integrity before replay.","Restore into a pristine fd-table state (no fds opened ahead of the journal)."],"tags":["wasix","journal","epoll","fd-renumber","snapshot-restore"],"backgroundTag":"journal-restore-failed","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}