clockworklabs/SpacetimeDB · critical · anyhow::Error

metadata.toml indicates that you are running

Error message

metadata.toml indicates that you are running {relation} database. Your running version is {:?}, but the database on disk is from {:?}.

What it means

Every database directory records the SpacetimeDB version that created it in metadata.toml. On open, the running binary compares that version against its own with a semver compatibility matcher; on mismatch it refuses to touch the data rather than risk corrupting on-disk state. The message says whether the on-disk database is newer, older, or otherwise incompatible relative to the running binary.

Solutions

  1. Run the SpacetimeDB version recorded in the database's metadata.toml (inspect the file under the database directory) so the data opens cleanly
  2. If upgrading was the intent, follow the documented upgrade/migration procedure instead of swapping binaries cold
  3. If the data is disposable, delete the database directory (or point at a fresh data dir) and let the new version initialize it
  4. Pin exact versions in deployment manifests (docker images, systemd units) so drift cannot happen silently

Example fix

# before: binary and data dir disagree
$ spacetimedb start --data-dir /data
error: metadata.toml indicates that you are running an incompatible database...

# after: run the version recorded on disk first, then upgrade properly
$ grep version "$(find /data -name metadata.toml | head -1)"
version = "1.x.y"
$ spacetimedb --version 1.x.y start --data-dir /data
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
# compare on-disk db version with the binary before start
db_ver=$(awk -F'"' '/^version/{print $2}' "$(find "$DATA_DIR" -name metadata.toml | head -1)")
bin_ver=$(spacetimedb --version | awk '{print $2}')
[ "$db_ver" = "$bin_ver" ] || echo "WARNING: db=$db_ver binary=$bin_ver - refusing mix" >&2

Prevention

When it happens

Trigger: Starting the node with a binary whose version is semver-incompatible with the one that wrote the database -- typically downgrading to an older release against existing data, or jumping across an incompatible major/minor boundary by swapping binaries without the upgrade path.

Common situations: Rolling back a server upgrade to debug an issue; alternating between dev and release builds on the same data dir; copying a data directory to a host running a different version; a long-lived data dir meeting a breaking release.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@fb7282411b (2026-08-20). Data as JSON: /api/errors/6397a032ef2c382c. Report an issue: GitHub.

Appendix: source

Thrown at crates/core/src/config.rs:106

            major: previous.version.major,
            minor: Some(previous.version.minor),
            patch: None,
            // We deal with pre-releases separately above.
            pre: semver::Prerelease::new("").unwrap(),
        };

        if cmp.matches(&current.version) {
            return Ok(());
        }

        let relation = if previous.version > current.version {
            "a newer, incompatible"
        } else if previous.version < current.version {
            "an older, incompatible"
        } else {
            "an incompatible"
        };
        anyhow::bail!(
            "metadata.toml indicates that you are running {relation} database. Your running version is {:?}, but the database on disk is from {:?}.",
            current.version,
            previous.version,
        );
    }

    /// Check if this meta file is compatible with the default meta
    /// file of a just-started database, and if so return the metadata
    /// to write back to the file.
    ///
    /// `self` is the metadata file read from a database, and current is
    /// the default metadata file that the active database version would
    /// right to a new database.
    pub fn check_compatibility_and_update(mut self, current: Self, metafile: &Path) -> anyhow::Result<Self> {
        Self::check_compatibility(&self, &current, metafile)?;
        // bump the version in the file only if it's being run in a newer database.
        self.version = std::cmp::max(self.version, current.version);
        Ok(self)

View on GitHub (pinned to fb7282411b)