{"record":{"id":"6397a032ef2c382c","repo":"clockworklabs/SpacetimeDB","slug":"metadata-toml-indicates-that-you-are-running-rela","errorCode":null,"errorMessage":"metadata.toml indicates that you are running {relation} database. Your running version is {:?}, but the database on disk is from {:?}.","messagePattern":"metadata\\.toml indicates that you are running (.+?) database\\. Your running version is (.+?), but the database on disk is from (.+?)\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"critical","filePath":"crates/core/src/config.rs","lineNumber":106,"sourceCode":"            major: previous.version.major,\n            minor: Some(previous.version.minor),\n            patch: None,\n            // We deal with pre-releases separately above.\n            pre: semver::Prerelease::new(\"\").unwrap(),\n        };\n\n        if cmp.matches(&current.version) {\n            return Ok(());\n        }\n\n        let relation = if previous.version > current.version {\n            \"a newer, incompatible\"\n        } else if previous.version < current.version {\n            \"an older, incompatible\"\n        } else {\n            \"an incompatible\"\n        };\n        anyhow::bail!(\n            \"metadata.toml indicates that you are running {relation} database. Your running version is {:?}, but the database on disk is from {:?}.\",\n            current.version,\n            previous.version,\n        );\n    }\n\n    /// Check if this meta file is compatible with the default meta\n    /// file of a just-started database, and if so return the metadata\n    /// to write back to the file.\n    ///\n    /// `self` is the metadata file read from a database, and current is\n    /// the default metadata file that the active database version would\n    /// right to a new database.\n    pub fn check_compatibility_and_update(mut self, current: Self, metafile: &Path) -> anyhow::Result<Self> {\n        Self::check_compatibility(&self, &current, metafile)?;\n        // bump the version in the file only if it's being run in a newer database.\n        self.version = std::cmp::max(self.version, current.version);\n        Ok(self)","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/fb7282411b0b73cc68d51e161f180cd409abd851/crates/core/src/config.rs#L88-L124","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run the SpacetimeDB version recorded in the database's metadata.toml (inspect the file under the database directory) so the data opens cleanly","If upgrading was the intent, follow the documented upgrade/migration procedure instead of swapping binaries cold","If the data is disposable, delete the database directory (or point at a fresh data dir) and let the new version initialize it","Pin exact versions in deployment manifests (docker images, systemd units) so drift cannot happen silently"],"exampleFix":"# before: binary and data dir disagree\n$ spacetimedb start --data-dir /data\nerror: metadata.toml indicates that you are running an incompatible database...\n\n# after: run the version recorded on disk first, then upgrade properly\n$ grep version \"$(find /data -name metadata.toml | head -1)\"\nversion = \"1.x.y\"\n$ spacetimedb --version 1.x.y start --data-dir /data","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n# compare on-disk db version with the binary before start\ndb_ver=$(awk -F'\"' '/^version/{print $2}' \"$(find \"$DATA_DIR\" -name metadata.toml | head -1)\")\nbin_ver=$(spacetimedb --version | awk '{print $2}')\n[ \"$db_ver\" = \"$bin_ver\" ] || echo \"WARNING: db=$db_ver binary=$bin_ver - refusing mix\" >&2","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin the spacetimedb version in docker/systemd so binaries cannot drift","Check metadata.toml against the binary version before every start","Use separate data dirs when experimenting with different versions","Follow the official upgrade path; never downgrade onto existing data"],"tags":["version","migration","database","storage","server-startup"],"backgroundTag":"database-version-mismatch","analyzedSha":"fb7282411b0b73cc68d51e161f180cd409abd851","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}