astrid-runtime/astrid · error

corpus input changed after the baseline snapshot; rerun agai

Error message

corpus input changed after the baseline snapshot; rerun against immutable inputs

What it means

`Baseline::validate` compares a previously captured baseline snapshot struct against a freshly observed one with full equality; any difference (size, blake3 identity, file list) bails. The library treats baseline mutation as invalid evidence and demands a rerun against immutable inputs.

Source

Thrown at crates/astrid-storage-chunker-evidence/src/corpus.rs:429

    fn finish(self) -> FileSnapshot {
        FileSnapshot {
            logical_bytes: self.bytes_read,
            identity: *self.hasher.finalize().as_bytes(),
        }
    }
}

impl FileSnapshot {
    fn from_bytes(bytes: &[u8]) -> Result<Self> {
        Ok(Self {
            logical_bytes: u64::try_from(bytes.len())?,
            identity: *blake3::hash(bytes).as_bytes(),
        })
    }

    fn validate(self, observed: Self) -> Result<()> {
        if self != observed {
            bail!(
                "corpus input changed after the baseline snapshot; rerun against immutable inputs"
            );
        }
        Ok(())
    }
}

impl<R: Read> Read for HashingReader<R> {
    fn read(&mut self, buffer: &mut [u8]) -> std::io::Result<usize> {
        let read = self.inner.read(buffer)?;
        self.hasher.update(&buffer[..read]);
        self.bytes_read = self
            .bytes_read
            .checked_add(u64::try_from(read).map_err(std::io::Error::other)?)
            .ok_or_else(|| std::io::Error::other("corpus byte count overflow"))?;
        Ok(read)
    }
}

View on GitHub (pinned to affd8760f4)

Solutions

  1. Restore the corpus files to the state recorded in the baseline (e.g. `git checkout -- <corpus dir>`)
  2. Regenerate the baseline snapshot deliberately if the new content is intended
  3. Pin inputs: copy the corpus to a read-only location and rerun against that copy

Example fix

// before
let corpus = Corpus::from_directory(...)?; // files were edited since baseline
baseline.validate(corpus.snapshot()?)?;
// after
std::process::Command::new("git").args(["checkout", "--", "corpus/"]).status()?;
let corpus = Corpus::from_directory(...)?;
baseline.validate(corpus.snapshot()?)?;
Defensive patterns

Strategy: validation

Validate before calling

let observed = corpus.snapshot()?;
if observed != baseline { regenerate_or_restore_baseline(); } else { baseline.validate(observed)?; }

Type guard

fn matches_baseline(observed: &Snapshot, baseline: &Baseline) -> bool { baseline == observed }

Try / catch

match baseline.validate(observed) {
    Ok(()) => proceed(),
    Err(e) if e.to_string().contains("changed after the baseline snapshot") => {
        eprintln!("inputs mutated; restoring from git and rerunning");
        restore_corpus_from_git();
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling `baseline.validate(observed)` when any `Input`'s logical bytes or blake3 identity hash differ from the baseline — i.e. files were edited, appended, truncated, or added/removed after the snapshot was taken.

Common situations: Rerunning the benchmark after modifying corpus files, datasets regenerated by scripts between runs, files on mutable network shares, or clocks/jobs touching files mid-run.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/46c86adc113dc567. Report an issue: GitHub.