{"record":{"id":"d720d30a5392850e","repo":"wasmerio/wasmer","slug":"read-only-journal-file-does-not-exist-journal","errorCode":null,"errorMessage":"Read-only journal file does not exist: {journal:?}","messagePattern":"Read-only journal file does not exist: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/cli/src/commands/run/wasi.rs","lineNumber":453,"sourceCode":"            for journal in w {\n                builder.add_writable_journal(journal);\n            }\n            builder.with_skip_stdio_during_bootstrap(self.skip_stdio_during_bootstrap);\n        }\n\n        Ok(builder)\n    }\n\n    #[cfg(feature = \"journal\")]\n    #[allow(clippy::type_complexity)]\n    pub fn build_journals(\n        &self,\n    ) -> anyhow::Result<(Vec<Arc<DynReadableJournal>>, Vec<Arc<DynJournal>>)> {\n        let mut readable = Vec::new();\n        for journal in self.read_only_journals.clone() {\n            if matches!(std::fs::metadata(&journal), Err(e) if e.kind() == std::io::ErrorKind::NotFound)\n            {\n                bail!(\"Read-only journal file does not exist: {journal:?}\");\n            }\n\n            readable\n                .push(Arc::new(LogFileJournal::new_readonly(journal)?) as Arc<DynReadableJournal>);\n        }\n\n        let mut writable = Vec::new();\n        for journal in self.writable_journals.clone() {\n            if self.enable_compaction {\n                let mut journal = CompactingLogFileJournal::new(journal)?;\n                if !self.without_compact_on_drop {\n                    journal = journal.with_compact_on_drop()\n                }\n                if self.with_compact_on_growth.is_normal() && self.with_compact_on_growth != 0f32 {\n                    journal = journal.with_compact_on_factor_size(self.with_compact_on_growth);\n                }\n                writable.push(Arc::new(journal) as Arc<DynJournal>);\n            } else {","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/cli/src/commands/run/wasi.rs#L435-L471","documentation":"build_journals checks each read-only journal path supplied via --journal before opening it with LogFileJournal::new_readonly. If the file's metadata returns NotFound, it fails fast with a clear message instead of a lower-level journal open error. Read-only journals must exist up front because they are replayed, never created.","triggerScenarios":"Passing a nonexistent file to --journal (read-only journal) so std::fs::metadata fails with ErrorKind::NotFound during prepare() or prepare_runtime().","commonSituations":"Typo in the journal filename; journal file deleted between runs; replaying a snapshot/journal that was never written on this machine; mounting a volume where the journal path doesn't exist; relative path resolving to the wrong directory.","solutions":["Verify the journal path exists with ls/stat and correct typos","Create the journal file first by running the workload with a writable journal before replaying it read-only","Check the working directory / use an absolute path for --journal","Remove the --journal flag if replay is not needed"],"exampleFix":"// before\nwasmer run app.wasm --journal ./snapshots/run.log\n// after\nls ./snapshots/run.log  # confirm it exists\nwasmer run app.wasm --journal \"$(realpath ./snapshots/run.log)\"","handlingStrategy":"validation","validationCode":"use std::path::Path;\nfn ensure_journal_exists(path: &str) -> Result<(), String> {\n    if Path::new(path).try_exists().map_err(|e| e.to_string())? {\n        Ok(())\n    } else {\n        Err(format!(\"read-only journal does not exist: {path}\"))\n    }\n}","typeGuard":"fn journal_file_exists(p: &str) -> bool {\n    std::fs::metadata(p).map(|m| m.is_file()).unwrap_or(false)\n}","tryCatchPattern":"match wasmer_run_with_journal(journal) {\n    Err(e) if e.to_string().contains(\"Read-only journal file does not exist\") => {\n        eprintln!(\"create or fix journal path: {journal}\");\n        Err(e)\n    }\n    other => other,\n}","preventionTips":["Stat every --journal path before invoking wasmer","Use absolute paths for journals to avoid CWD confusion","Record journals with a writable journal first; only replay existing files read-only","Ensure CI/artifact steps actually publish the journal file before the replay step"],"tags":["cli","wasi","journal","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}