{"record":{"id":"3163d9ca5f8d9b01","repo":"wasmerio/wasmer","slug":"journal-restore-error-failed-to-renumber-descript","errorCode":null,"errorMessage":"journal restore error: failed to renumber descriptor (from={}, to={}) - {}","messagePattern":"journal restore error: failed to renumber descriptor \\(from=(.+?), to=(.+?)\\) - (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/wasix/src/journal/effector/syscalls/fd_renumber.rs","lineNumber":25,"sourceCode":"        to: Fd,\n    ) -> anyhow::Result<()> {\n        Self::save_event(\n            ctx,\n            JournalEntry::RenumberFileDescriptorV1 {\n                old_fd: from,\n                new_fd: to,\n            },\n        )\n    }\n\n    pub fn apply_fd_renumber(\n        ctx: &mut FunctionEnvMut<'_, WasiEnv>,\n        from: Fd,\n        to: Fd,\n    ) -> anyhow::Result<()> {\n        let ret = crate::syscalls::fd_renumber_internal(ctx, from, to);\n        if !matches!(ret, Ok(Errno::Success)) {\n            bail!(\n                \"journal restore error: failed to renumber descriptor (from={}, to={}) - {}\",\n                from,\n                to,\n                ret.unwrap_or(Errno::Unknown)\n            );\n        }\n        Ok(())\n    }\n}\n","sourceCodeStart":7,"sourceCodeEnd":35,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/wasix/src/journal/effector/syscalls/fd_renumber.rs#L7-L35","documentation":"apply_fd_renumber replays an FdRenumber journal entry by calling fd_renumber_internal(from, to); any result other than Errno::Success raises this error. It means a descriptor could not be moved from `from` to `to`, leaving the restored fd table inconsistent with the snapshot.","triggerScenarios":"Journal restore replaying an FdRenumber entry where `from` doesn't exist, `to` is occupied by a non-removable/preopen descriptor, or the internal renumber returns an errno (e.g. Badf, Notcapable).","commonSituations":"Restoring into an environment with different preopened fds; journals replayed out of order; snapshot/restore across different runtime versions.","solutions":["Regenerate the snapshot and retry the restore.","Ensure preopen/mount configuration matches between capture and restore environments.","Verify journal ordering and completeness.","Align runtime versions between snapshot and restore."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-flight: both fds must be renamable per the snapshot's fd table\nlet ok = journal.renumber_entries().iter().all(|r|\n    env.fd_exists(r.from) && (env.fd_free(r.to) || env.fd_removable(r.to))\n);\nif !ok { return Err(anyhow::anyhow!(\"fd renumber preconditions not met; align env with snapshot\")); }","typeGuard":null,"tryCatchPattern":"match restore_from_journal(&env, &journal) {\n    Err(e) if e.to_string().contains(\"failed to renumber descriptor\") => {\n        eprintln!(\"renumber failed: {e}; rebuilding env from fresh snapshot\");\n        resume_with_fresh_snapshot()?;\n    }\n    other => other?,\n}","preventionTips":["Replay journals strictly in original order.","Match preopens and fd layout between capture and restore.","Pin the runtime version across snapshot/restore."],"tags":["wasix","journal","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"}