wasmerio/wasmer · error

Read-only journal file does not exist: {journal:?}

Error message

Read-only journal file does not exist: {journal:?}

What it means

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.

Source

Thrown at lib/cli/src/commands/run/wasi.rs:453

            for journal in w {
                builder.add_writable_journal(journal);
            }
            builder.with_skip_stdio_during_bootstrap(self.skip_stdio_during_bootstrap);
        }

        Ok(builder)
    }

    #[cfg(feature = "journal")]
    #[allow(clippy::type_complexity)]
    pub fn build_journals(
        &self,
    ) -> anyhow::Result<(Vec<Arc<DynReadableJournal>>, Vec<Arc<DynJournal>>)> {
        let mut readable = Vec::new();
        for journal in self.read_only_journals.clone() {
            if matches!(std::fs::metadata(&journal), Err(e) if e.kind() == std::io::ErrorKind::NotFound)
            {
                bail!("Read-only journal file does not exist: {journal:?}");
            }

            readable
                .push(Arc::new(LogFileJournal::new_readonly(journal)?) as Arc<DynReadableJournal>);
        }

        let mut writable = Vec::new();
        for journal in self.writable_journals.clone() {
            if self.enable_compaction {
                let mut journal = CompactingLogFileJournal::new(journal)?;
                if !self.without_compact_on_drop {
                    journal = journal.with_compact_on_drop()
                }
                if self.with_compact_on_growth.is_normal() && self.with_compact_on_growth != 0f32 {
                    journal = journal.with_compact_on_factor_size(self.with_compact_on_growth);
                }
                writable.push(Arc::new(journal) as Arc<DynJournal>);
            } else {

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Verify the journal path exists with ls/stat and correct typos
  2. Create the journal file first by running the workload with a writable journal before replaying it read-only
  3. Check the working directory / use an absolute path for --journal
  4. Remove the --journal flag if replay is not needed

Example fix

// before
wasmer run app.wasm --journal ./snapshots/run.log
// after
ls ./snapshots/run.log  # confirm it exists
wasmer run app.wasm --journal "$(realpath ./snapshots/run.log)"
Defensive patterns

Strategy: validation

Validate before calling

use std::path::Path;
fn ensure_journal_exists(path: &str) -> Result<(), String> {
    if Path::new(path).try_exists().map_err(|e| e.to_string())? {
        Ok(())
    } else {
        Err(format!("read-only journal does not exist: {path}"))
    }
}

Type guard

fn journal_file_exists(p: &str) -> bool {
    std::fs::metadata(p).map(|m| m.is_file()).unwrap_or(false)
}

Try / catch

match wasmer_run_with_journal(journal) {
    Err(e) if e.to_string().contains("Read-only journal file does not exist") => {
        eprintln!("create or fix journal path: {journal}");
        Err(e)
    }
    other => other,
}

Prevention

When it happens

Trigger: Passing a nonexistent file to --journal (read-only journal) so std::fs::metadata fails with ErrorKind::NotFound during prepare() or prepare_runtime().

Common situations: 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.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01). Data as JSON: /api/errors/d720d30a5392850e. Report an issue: GitHub.