jdx/mise · error

Postgres data version does not match its initialization…

Error message

Postgres data version does not match its initialization marker

What it means

As an integrity check for postgres, after the version marker matches, initialize also reads the data directory's PG_VERSION file and requires it to equal the detected major. If it differs, the on-disk data does not correspond to its own initialization marker and mise bails out.

Solutions

  1. Re-initialize the data directory fresh (after backing up/dumping any needed data)
  2. Fix the .mise-daemon-version marker to match PG_VERSION only if you know the data is genuinely that major
  3. Run pg_upgrade to actually migrate data to the target major, then re-init markers

Example fix

// shell before: marker says 16, PG_VERSION says 15
// after: make them consistent
pg_dump ... && rm -rf data && mise daemon init postgres
Defensive patterns

Strategy: validation

Validate before calling

cat data/PG_VERSION; cat data/.mise-daemon-version # majors must agree

Prevention

When it happens

Trigger: An existing data dir whose PG_VERSION (written by initdb) disagrees with the .mise-daemon-version marker's major — e.g. the data dir was hand-edited, partially restored, or markers were copied between data dirs.

Common situations: Copying .mise-daemon-version from another data directory; interrupted or manual migration; tampered or corrupted data directory.

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 jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/d4a465a50a710dd9. Report an issue: GitHub.

Appendix: source

Thrown at src/daemons/presets.rs:211

    let marker = format!("{preset_name}:{major}\n");
    if data.exists() {
        let existing = std::fs::read_to_string(data.join(".mise-daemon-version"))
            .wrap_err("daemon data was not initialized completely; inspect it and migrate or reset it explicitly")?;
        if existing != marker {
            bail!(
                "incompatible {preset_name} data in {} (stored {}, current {}); migrate or reset it explicitly",
                data.display(),
                existing.trim(),
                marker.trim()
            );
        }
        if preset_name == "postgres"
            && std::fs::read_to_string(data.join("PG_VERSION"))
                .wrap_err("daemon data was not initialized completely; missing PG_VERSION")?
                .trim()
                != major
        {
            bail!("Postgres data version does not match its initialization marker");
        }
        return Ok(());
    }
    let staging = tempfile::Builder::new()
        .prefix(".mise-init-")
        .tempdir_in(parent)?;
    let staged_data: PathBuf = staging.path().join("data");
    if preset_name == "postgres" {
        let status = Command::new("initdb")
            .args(["-D"])
            .arg(&staged_data)
            .args(["-U", "postgres", "--auth=trust"])
            .status()?;
        if !status.success() {
            bail!("Postgres initialization failed; existing data was preserved");
        }
        if database != "postgres" {
            if database.is_empty()

View on GitHub (pinned to 533346cc37)