{"record":{"id":"4ea943f0b8bfa2b8","repo":"clockworklabs/SpacetimeDB","slug":"v-version-is-not-installed","errorCode":null,"errorMessage":"v{version} is not installed","messagePattern":"v(.+?) is not installed","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/update/src/cli/uninstall.rs","lineNumber":33,"sourceCode":"impl Uninstall {\n    pub(super) fn exec(self, paths: &SpacetimePaths) -> anyhow::Result<()> {\n        let Self { version, yes } = self;\n        anyhow::ensure!(\n            version != BinDir::CURRENT_VERSION_DIR_NAME,\n            \"cannot remove `current` version\"\n        );\n        match paths\n            .cli_bin_dir\n            .current_version()\n            .context(\"couldn't read current version\")\n        {\n            Ok(Some(current)) => anyhow::ensure!(version != current, \"cannot uninstall currently used version\"),\n            Ok(None) => {}\n            Err(e) => tracing::warn!(\"{e:#}\"),\n        }\n        let dir = paths.cli_bin_dir.version_dir(&version);\n        if !dir.0.exists() {\n            anyhow::bail!(\"v{version} is not installed\");\n        }\n        if yes.confirm(format!(\"Uninstall v{version}?\"))? {\n            std::fs::remove_dir_all(&dir)?;\n        }\n        Ok(())\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use spacetimedb_paths::FromPathUnchecked;\n    use spacetimedb_paths::RootDir;\n\n    fn make_temp_paths() -> (tempfile::TempDir, SpacetimePaths) {\n        let tmp = tempfile::tempdir().unwrap();\n        let base = tmp.path().join(\"spacetime\");\n        std::fs::create_dir_all(&base).unwrap();","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/update/src/cli/uninstall.rs#L15-L51","documentation":"The `spacetime-install uninstall <version>` subcommand (crates/update/src/cli/uninstall.rs:33) maps the version string to a directory under the CLI bin dir via paths.cli_bin_dir.version_dir(&version) and bails when that directory does not exist. The version must name an actually installed version directory; the literal name `current` and the currently-used version are also refused earlier (lines 18-27).","triggerScenarios":"Running `spacetime-install uninstall 9.9.9` (or any version never installed, already removed, or mistyped - note the directory lookup uses the bare version string like `1.2.3`, not a `v` prefix); the update tooling pointed at a different SpacetimeDB root than where the version lives, so version_dir resolves elsewhere.","commonSituations":"CI cleanup scripts uninstalling a pinned version after a cache wipe already removed it; uninstalling right after a fresh install where the version string was recorded with a `v` prefix or a tag; multiple SPACETIMEDB root directories on one machine.","solutions":["List the actually installed version directories under the CLI bin dir (the same root spacetime-install manages) and copy the exact version string.","Pass the bare semver directory name, e.g. `spacetime-install uninstall 1.2.3`, matching how the installer created the directory.","If it was already uninstalled, treat the error as success in scripts (idempotent cleanup: check for the directory or tolerate this message).","Verify the tooling resolves the same root you installed into (environment overrides for the SpacetimeDB paths) before uninstalling."],"exampleFix":"# before: version never installed / wrong string form\nspacetime-install uninstall v1.2.3   # bails: v1.2.3 is not installed\n# after: exact installed version directory name\nspacetime-install uninstall 1.2.3","handlingStrategy":"validation","validationCode":"// Rust (embedding the update tooling): check before uninstalling.\nlet dir = paths.cli_bin_dir.version_dir(&version);\nif !dir.0.exists() {\n    // already gone: make cleanup idempotent\n    return Ok(());\n}\nUninstall { version, yes: ForceYes { yes: true } }.exec(paths)?;","typeGuard":null,"tryCatchPattern":"// In shell scripts, tolerate the already-gone case:\n# spacetime-install uninstall \"$VER\" 2>&1 | grep -q \"is not installed\" && exit 0","preventionTips":["Make uninstall steps idempotent: check the version directory exists (or grep for 'is not installed') before failing CI.","Record installed version names exactly as the installer created them (bare semver like 1.2.3, no `v` prefix) in your scripts.","Never script uninstall of `current` or the in-use version - the command refuses both by design."],"tags":["spacetimedb","cli","update-tooling","uninstall","versioning"],"backgroundTag":"version-not-installed","analyzedSha":"6dee26c6efc2856793e12b148a59742964f5d783","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}